MAINT: Implement lstsq as a gufunc#9980
Conversation
341536c to
110de75
Compare
110de75 to
65df2aa
Compare
lstsq as a gufunclstsq as a gufunc
mhvk
left a comment
There was a problem hiding this comment.
I very much like this! And it all looks great. Ideally, we allow lstsq now to take single precision inputs, but that is probably better done in a follow-up PR as well (not sure how best to handle it; new argument to tell whether to allow single precision?)
Relatedly, since we expose the single-precision routines, we would ideally also test those, but I think that is also fine to leave to a next PR.
numpy/linalg/linalg.py
Outdated
There was a problem hiding this comment.
Is this necessary given that the inputs are coerced already?
There was a problem hiding this comment.
The inputs don't look coerced already to me
There was a problem hiding this comment.
Ah, yes, above one just gets the types for later conversion. Should have noticed that.
I think we're stuck with not doing this, in the same way that |
|
An earlier version exposed twice as many ufuncs, |
|
Once this goes in, I have another commit that promotes |
|
I think in principle we could add a |
Of course, then we run into #9444. I'd be in favor of allowing single-precision via |
729e6eb to
89bca66
Compare
|
Rebased, and slightly squashed. Good to go, @mhvk? |
This does not yet enable any broadcasting, but makes doing so in future far easier.
89bca66 to
3ef55be
Compare
|
Yes, this looks good, modulo that there should at least be new issues reminding us to introduce a |
|
Would you consider #9516 to be that issue? |
|
I think a new one is better (more focused); see #10888 . Will now merge this one. |
A summary of what this does
sandcvaraiants ofgelsd(not used by lstsq, but there if people need them) (the very large diffs are simply what happens when regeneratinglapack_lite)lstsqto fall back on one of two gufuncs (that share a loop)What this does not try to do yet, since there are decisions to be made for these:
0core dimensionLike #9976 (merged), this needs lapack 3.2.2.
This was tested for exact equality by placing asserts within
lstsqcomparing old and new values, and rerunning the test suite.