Open keewis opened 1 day ago
Your second example should work. And asarray
also accepts the mask. Have you tried
import marray
import numpy as np
xp = marray.masked_array(np)
a = xp.asarray(np.arange(10), mask=(np.arange(10) % 2 == 0))
?
Currently mask
doesn't appear in the documentation, because it's just copied from NumPy, but that can come later.
That's interesting, I totally missed that. I was under the (quite possibly mistaken?) assumption that the Array API didn't allow adding additional arguments, so I didn't even bother to check.
I'm not certain whether the standard disallows that sort of thing, but NumPy 2.1 asarray
has an order
argument that is not in the standard. I'm sure there are many more examples.
While the idea of using a function to create a nested namespace is neat, it makes creating arrays harder:
What I'd like to have (but don't quite know how easy it is to support, nor if it actually is a good idea) is something like this:
Alternatively, this could also work (since the Array API doesn't forbid adding non-standard things to the namespace):
However, I would imagine that this makes creating / composing arrays a bit harder. And since we don't subclass arrays classes anymore, maybe we don't even need the dynamic namespace (and thus the meta-programming)?