-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add generalized ufunc linalg functions and make numpy.linalg use them #3220
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
Looks like it needs a rebase. |
… code from the matrix_multiply in other gufuncs
…ue and the functions are not guaranteed to work with them). also got cholesky working.
…al due to a bug in the harness.
… functions (as is made in linalg module). Changed some code so that it uses BLAS instead of cblas (the fortran functions) also in line with what it is done on linalg. Modified the matrix multiply code, made it simpler and adapted to use blas (it was using cblas with CblasRowMajor, that is not available in the fortran function.
… and needed by out library. It seems to work now on Linux.
…ed from PDL" ufuncs). Only missing from "inspired from PDL" is matrix_multiply3.
added chosolve and poinv, they need testing.
… also a patched f2c to remove warnings.
…. Some bugs already fixed.
…changed to assignment
Also, link umath_linalg against the system BLAS/LAPACK if available.
Rebased. |
Is there a test for the FP flags thing (63a8aef)? That seems like it could use a test. For the double/single issue, does it work to use the ufunc |
@njsmith: The
The |
@pv: I think that |
…erations This ensures that the FP invalid flag always reflects the return code from LAPACK. Fixes a bug in 63a8aef where umath_linalg raises a warning only if the error occurs in the last iteration of the ufunc inner loop.
Using |
With the new ufunc-based linalg, GIL is released in ufuncs, and needs to be reacquired when raising errors in xerbla_.
If an exception is pending (raised from xerbla), the routines must return NULL.
And then fixes for a GIL bug if a LAPACK error condition occurs. |
@pv Do you feel this is in a state to go in? |
I'm not aware of anything that breaks with this change (scipy, nipy, scikit-learn, pandas, statsmodels, networkx seem to suffer no regressions). Although this PR doesn't implement everything in the roadmap, it stands alone OK, and I think there's not more to add to it. Should be advertised on the ML after (or before) merging. |
The list post is getting much (any) response, but I'll wait a few more days. @pv What about something like |
@charris: I don't see immediate use cases for npylapack_lite, as BLAS is widely available, if that's what you meant. |
No further input seems to be coming, so maybe if there are no remaining concerns, we can merge and be done with it. |
OK, in it goes. |
Add generalized ufunc linalg functions and make numpy.linalg use them
This is a followup to gh-2954 (list of new commits), which replaces numpy.linalg routines with the corresponding umath_linalg implementations, while preserving backward compatibility for ndim <= 2 inputs. The new code is all under numpy/linalg.
Numpy's test suite and those of Scipy, Pandas, and Nipy pass with these changes, so there probably aren't obvious problems with backward compat.
This PR doesn't add new functions to numpy.linalg, only replaces existing ones. That, and other things still to do are summarized in issue gh-3217.