You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happens is the __mul__ method of NDVarArray w tries to call __mul__ on each of the elements in that array. I.e., 10.__mul__(x[0]), 20.__mul__(x[1])... but the built-in type int has no idea how to multiply with our custom objects.
Instead of calling __rmul__ on our objects as it does when expressing 10 * x[0], a NotImplementedError is returned.
Helene exposed an issue with our implementation of the NDVarArray overridden functions (mul, add....) in pull request #337
To reproduce:
What happens is the
__mul__
method of NDVarArrayw
tries to call__mul__
on each of the elements in that array. I.e.,10.__mul__(x[0])
,20.__mul__(x[1])
... but the built-in typeint
has no idea how to multiply with our custom objects.Instead of calling
__rmul__
on our objects as it does when expressing10 * x[0]
, aNotImplementedError
is returned.Did some research on how to properly subclass a
np.ndarray
and it seems we don't really need the_vectorized
thingy...https://numpy.org/doc/stable/reference/arrays.classes.html
The text was updated successfully, but these errors were encountered: