Nathaniel Smith <njs <at> pobox.com> writes:
> > An obvious thing is that it always computes residuals, which could be > costly; if your pinv code isn't doing that then it's not really > comparable. (Though might still be well-suited for your actual > problem.) > > Depending on how well-conditioned your problems are, and how much > speed you need, there are faster ways than pinv as well. (Going via qr > might or might not, going via cholesky almost certainly will be.) > > -n > You are right. With calculating the residuals, the speedup goes down to a factor of 2. I had to calculate the residuals anyways because lstsq only returns the squared sum of the residuals, while i need every residual (as an input to optimize.leastsq). Josef is also right, it is shape depended. For his example, lstsq is faster. Maybe it is possible to make lstsq to choose its method automatically? Or some keyword to set the method and making other decompositions available. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion