[Numpy-discussion] performance issue (again)

josef.pktd@gmai... josef.pktd@gmai...
Wed Apr 22 11:38:32 CDT 2009

On Wed, Apr 22, 2009 at 11:48 AM, Mathew Yeates <myeates@jpl.nasa.gov>wrote:

> well, this isn't a perfect solution. polyfit  is better because it
> determines rank based on condition values. Finds the eigenvalues ...
> etc. But, unless it can vectorized without Python looping, it's too slow
> for me to use

rank is a property of the design matrix.

In your case the design matrix is a vector of ones and the x vector. So the
only case, where you run into problems, is when your three observation of x
are the same, then dot(x.T*x) is zero, you can only have one constant. If
there is no slope in x then you don't have three different observations to
estimate a slope coefficient.

Just special case (x*x).sum(1)<1e-8   or something, in this case
yestimate = y.mean

eigen vectors with one regressor are pretty useless or trivial, same with

For higher order polynomials this will become more important, but not for a
linear polynomial.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090422/3f49fa41/attachment.html 

More information about the Numpy-discussion mailing list