Commit e3f57b79 authored by Ronan Hamon's avatar Ronan Hamon

simplify __array_ufunc__ and remove __array_ufunc__ in MadArray

parent df5fa127
Pipeline #465 failed with stage
in 20 seconds
......@@ -293,11 +293,10 @@ class MadArray(np.ndarray):
self._complex_masking = getattr(obj, '_complex_masking', None)
self._masked_indexing = getattr(obj, '_masked_indexing', None)
def __array_wrap__(self, obj, context=None):
return obj[()] if obj.shape == () else obj
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
print(method)
args = []
is_mad = []
for input_ in inputs:
......@@ -333,24 +332,12 @@ class MadArray(np.ndarray):
if outputs:
out_args = []
for output in outputs:
if isinstance(output, MadArray):
out_args.append(output.view(np.ndarray))
else:
out_args.append(output)
out_args.append(output.view(np.ndarray))
kwargs['out'] = tuple(out_args)
else:
outputs = (None,) * ufunc.nout
results = super().__array_ufunc__(ufunc, method, *args, **kwargs)
if results is NotImplemented:
return NotImplemented
if method == 'at':
return
if ufunc.nout == 1:
results = (results,)
results = (super().__array_ufunc__(ufunc, method, *args, **kwargs), )
new_results = []
for result, output in zip(results, outputs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment