[Numpy-discussion] Help with linear_least_squares

Brad Malone brad.malone@gmail....
Wed Mar 28 12:54:54 CDT 2007


Hi, I'm running into an error with linear least squares that I'm not sure
what to do about.  For reference, I'm trying to fit a curve corresponding to
the example at the bottom of this wikipedia page:
http://en.wikipedia.org/wiki/Linear_least_squares

My code looks like this:

from numpy import *
import LinearAlgebra
A=array([0,1,2,1,4,1,-1,1])
A.shape=(4,2)
b=array([3,3,4,2])
b.shape= (4,1)
sol=LinearAlgebra.linear_least_squares(A,b)





And I'm getting the following error:
 File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/Numeric/LinearAlgebra.py", line
410, in linear_least_squares
    t =_commonType(a, b)
  File "/usr/lib/python2.4/site-packages/Numeric/LinearAlgebra.py", line 30,
in _commonType
    t = a.typecode()
AttributeError: 'numpy.ndarray' object has no attribute 'typecode'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070328/5864deba/attachment.html 


More information about the Numpy-discussion mailing list