-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
BUG: add missing ufunc helpers for np.matvec
and np.vecmat
#17464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: add missing ufunc helpers for np.matvec
and np.vecmat
#17464
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
5ae825c
to
57e713a
Compare
np.matvec
and np.vecmat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I could have thought about this myself...
One request: would you be able to add tests? In astropy/units/tests/test_quantity_ufuncs.py
(after matmul
/vecdot
) and in astropy/utils/masked/test_masked.py
, adding to or with the existing vecmat
and matvec
tests that use @
.
p.s. And, yes, should be backported - we always try to ensure the current version will run with latest numpy.
57e713a
to
1303114
Compare
test added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note about location. Also, please do add a test in utils/masked
(see previous review message) - it should not require explicitly adding to anything, but we need to test that!
@@ -2702,6 +2703,29 @@ def test_vector_norm(self): | |||
assert_array_equal(n2, expected2) | |||
|
|||
|
|||
@pytest.mark.skipif(NUMPY_LT_2_3, reason="np.matvec and np.vecmat are new in NumPy 2.3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to be annoying, but this should be in test_quantity_ufunc
(gufuncs are there too...), with matmul
and vecdot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no annoyance at all. Thanks for your attention to details !
1303114
to
727094b
Compare
I'm actually getting unexpected errors from my test, and I'm running out of time to fix them today, so I just pushed a broken test for now. |
727094b
to
cb64713
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there didn't seem to be much wrong with the test you wrote, I force-pushed a quick fix. With this, it all looks good, so approving and enabling merge.
…vec` and `np.vecmat`
…464-on-v7.0.x Backport PR #17464 on branch v7.0.x (BUG: add missing ufunc helpers for `np.matvec` and `np.vecmat`)
Description
example logs
xref: numpy/numpy#25675
given how small the change, I think we should backport to 7.0.1