[Numpy-discussion] Linear least squares
Charles R Harris
Tue Jan 8 23:11:30 CST 2013
On Tue, Jan 8, 2013 at 11:17 AM, Till Stensitz <email@example.com> wrote:
> i did some profiling and testing of my data-fitting code.
> One of its core parts is doing some linear least squares,
> until now i used np.linalg.lstsq. Most of time the size
> a is (250, 7) and of b is (250, 800).
> Today i compared it to using pinv manually,
> to my surprise, it is much faster. I taught,
> both are svd based? Too check another computer
> i also run my test on wakari:
> Also using scipy.linalg instead of np.linalg is
> slower for both cases. My numpy and scipy
> are both from C. Gohlkes website. If my result
> is valid in general, maybe the lstsq function
> should be changed or a hint should be added
> to the documentation.
Do you know if both are using Atlas (MKL)? Numpy will compile a default
unoptimized version if there is no Atlas (or MKL). Also, lstsq is a direct
call to an LAPACK least squares function, so the underlying functions
themselves are probably different for lstsq and pinv.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion