[SciPy-Dev] Least-Squares Linear Solver ( scipy.linalg.lstsq ) not optimal

Eric Moore ewm at redtetrahedron.org
Mon Feb 9 09:49:40 EST 2015


FWIW, this is also what scipy.linalg.pinv2 does.

On Mon, Feb 9, 2015 at 9:39 AM, Sturla Molden <sturla.molden at gmail.com>
wrote:

> On 09/02/15 14:29, josef.pktd at gmail.com wrote:
>
> > in statsmodels we are using mostly np.linalg.pinv which is just an svd
> > and a dot product
> > (no identity matrix)
>
> Yes.
>
> numpy.linalg.pinv just calls SVD and a dot product as you say, and there
> is no redundant computation.
>
> scipy.linalg.pinv calls lstsq with an identity matrix on RHS.
>
>
> > np.linalg.pinv was considerably faster than scipy.linalg.pinv when I
> > checked it a few years ago
> > (outdated information because code in scipy has changed).
>
> They are still different, it appears, but I am not sure which is faster.
>
> NumPy's pinv has larger Python overhead but does less computation in
> BLAS and LAPACK.
>
> Both will copy and transpose X if it is in C order.
>
>
> Sturla
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20150209/fb1a5ba0/attachment.html>


More information about the SciPy-Dev mailing list