-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: Add a pinvh function to linalg. #12665
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
Conversation
Is there a reason to put this in NumPy rather than extend the SciPy version? In general we'd like to keep the two in sync for features we have already in both, and put new features in SciPy unless there's a really good reason to put things in NumPy. Note that incompatible changes will also break (or not have) Numba support for those new features. Numba uses |
@eric-wieser that could work! I was just trying to mirror the format of Scipy here. @rgommers My reasoning was that Scipy uses its own internal functions, like In regards to the Numba issue, what would it take to add that support? I'm not super familiar with the way it interacts with Numpy/Scipy and using BLAS/LAPACK directly. Thanks! |
s, u = eigh(a, UPLO='L') | ||
|
||
# discard small singular values | ||
cutoff = rcond[..., newaxis] * amax(s, axis=-1, keepdims=True) |
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.
I think this is incorrect - eigh
can return negative values of s
, hence the abs
in the other PR
That's a good argument. Fair enough.
I don't think there's a lot of thought put into that, it just evolved. In general, we do want APIs to match between NumPy and SciPy, and NumPy to provide the essentials and SciPy to be a superset of what NumPy has.
I could read the Numba code base to find the answer, but better to ask the Numba devs I think. @seibert any thoughts/comments on how Numba deals with an evolving |
@rgommers and @eric-wieser is this PR still worth pursuing given #12693? |
Not now that #12693 is merged. Thanks for providing the catalyst for that PR! |
This is a faster version of
linalg.pinv
for Hermitian matrices. It is like the Scipy version ofpinvh
, but supports stacked matrices like Numpy'spinv
.