Uh oh!
There was an error while loading. Please reload this page.
Conversation
rgommers
commented
Jan 26, 2021
The JAX docs say that behaviour matches NumPy, empty array can be returned: jax.readthedocs.io/en/latest/_autosummary/jax.numpy.linalg.lstsq.html. The in-progress PR for |
kgryte
commented
Jan 26, 2021
@rgommers Re: JAX. Sorry, I should have clarified. JAX's default behavior does not match NumPy's.
I've updated the OP accordingly. |
kgryte
commented
Feb 16, 2021
Renamed |
kgryte
commented
Mar 4, 2021
Renamed |
leofang
commented
Mar 11, 2021
The PR looks fine to me, just a few high-level design questions:
I feel it's not very convenient to always request a matrix and forbid vector inputs. I understand we can always broadcast ifx1.ndim==x2.ndim+1:
x2=x2[..., None] # or use newaxisassertx1.ndim==x2.ndim
No, NumPy and CuPy return a tuple. Given that we didn't return namedtuple in SVD, perhaps we shouldn't do it here either to be consistent? |
kgryte
commented
Mar 11, 2021
leofang
commented
Mar 11, 2021
Ah OK, thanks Athan! I missed that and thought |
kgryte
commented
Mar 24, 2021
@leofang Re: matrix/vector input. I've updated the proposal to include support for an ordinate vector. |
0607525 to
138e963Comparekgryte
commented
May 12, 2021
Thanks, @leofang, for the review! This PR is ready for merge... |
This PR
Notes
Only TF allows for providing a stack of matrices. Torch, MXNet, CuPy, NumPy, and JAX do not. This proposal follows TF and ensures consistency with other linalg interfaces which currently support stacks.
TF supports
l2_regularizerandfastkeyword arguments and is alone in doing so.Neither Dask, Torch, nor TF support an
rcondkeyword argument. This proposal includes anrtolargument (note:rtolis renamed fromrcondto unify tolerance keywords acrosspinv,lstsq, andmatrix_rank), similar to the pinv proposal.Similar to pinv, the
rcondargument can either be afloator anarrayand have default values determined by type promotion rules.NumPy, MXNet, CuPy, and JAX all support
bbeing specified as either a vector or matrix. TF requires an(..., M,K)matrix. This PR follows NumPy.Return results:
rankfield which is an array.rankfield which is an integer.residualsfield which is empty for low-rank or over-determined solutions. JAX always returns residuals for JIT purposes, unless one setsnumpy_resid=True.This proposal returns a namedtuple with a
rankfield which is an array due to support for providing stacks of matrices and also returns that theresidualsfield always be returned, following JAX.