lstsq
tries to solve Ax=b
minimizing |b - Ax|
. Both scipy and numpy provide a linalg.lstsq
function with a very similar inter
If I read the source code right (Numpy 1.8.2, Scipy 0.14.1
), numpy.linalg.lstsq()
uses the LAPACK routine xGELSD
and scipy.linalg.lstsq()
usesxGELSS
.
The LAPACK Manual Sec. 2.4 states
The subroutine xGELSD is significantly faster than its older counterpart xGELSS, especially for large problems, but may require somewhat more workspace depending on the matrix dimensions.
That means that Numpy is faster but uses more memory.
Update August 2017:
Scipy now uses xGELSD by default https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.lstsq.html