ENH: add mparray backend - #963
Conversation
[skip ci]
| atol=1e-11, | ||
| ) | ||
|
|
||
| @pytest.mark.skip_xp_backend(Backend.MPARRAY, reason="negative zero not supported") |
There was a problem hiding this comment.
This is just a fundamental limitation of mpmath, it seems. I don't think fixing it is high priority.
| Backend.TORCH_GPU, reason="device->host copy" | ||
| ), | ||
| pytest.mark.skip_xp_backend(Backend.SPARSE, reason="densification"), | ||
| pytest.mark.skip_xp_backend(Backend.MPARRAY, reason="precision loss"), |
There was a problem hiding this comment.
I'm not sure how as_numpy=True should work. I think np.asarray(my_mparray) currently wraps my_mparray as the only element of an object array. Instead, it could:
- Extract the underlying object array, but I don't think that's what this is supposed to do.
- Converted the underlying object array to a numerical NumPy array, but it risks precision loss.
- Raise.
There was a problem hiding this comment.
Let's open an issue on the mparray side for this one, given that it isn't entirely clear which way to go yet. That would be sufficient to move forward here
|
|
||
|
|
||
| @pytest.mark.skip_xp_backend(Backend.TORCH_GPU, reason="device->host copy") | ||
| @pytest.mark.skip_xp_backend(Backend.MPARRAY, reason="mparray lacks __array_ufunc__") |
There was a problem hiding this comment.
I don't think we want compiled ufuncs to work on these if they don't preserve the precision; it's probably better to fail. (However, mparray.special will provide a lot of special functions, and scipy.special will be able to delegate to them.)
lucascolley
left a comment
There was a problem hiding this comment.
great to see how small a diff this requires :)
|
why does |
|
No, I've been trying to fix the Python 3.13 requirement. It was added because
But for now, that will just mean we don't run array-api-tests in CI with Python 3.10/3.11. There's no other incompatibility, so now I'm just waiting for mparray 0.2.2 to propagate to conda-forge, then I can update this PR. |
|
I'm happy with this if you are. I can open up issues in the mparray repo about the |
lucascolley
left a comment
There was a problem hiding this comment.
commented about one upstream issue that would be nice, otherwise this looks great, thanks Matt!
|
Thanks @lucascolley. Opened mdhaber/mparray#22 to remind us to consider |
Reference issue
Toward scipy/scipy#24840
What does this implement/fix?
This adds MPArray as a tested backend of array-api-extra.
Additional information
Skipping CI until conda-forge has the latest MPArray release (v0.2.0 recently released on PyPI), but tests are passing locally with the editable install.
Are there other things I should do (e.g. update documentation somewhere)?
AI Generation Disclosure
I told ChatGPT to work mparray into the testing. It made some changes so I could see what was needed, then I changed almost everything in some way.