problem in using linalg solver in numpy
Peter Otten
__peter__ at web.de
Sat Aug 14 20:46:01 CEST 2010
Pramod wrote:
> When run the below program in python i got error like this ,
>
>
> Matrix
> [[ 8 -6 2]
> [-4 11 -7]
> [ 4 -7 6]]
> row vecotr X
> [[ 28 -40 33]]
> Traceback (most recent call last):
> File "solve.py", line 16, in <module>
> print A*B
> File "/usr/lib/python2.6/dist-packages/numpy/core/defmatrix.py",
> line 290, in __mul__
> return N.dot(self, asmatrix(other))
> ValueError: objects are not aligned
> A=matrix([[int(fr.readline()) for j in range(N)]for i in range(N)])
> B=matrix([[int(fr.readline())for j in range(N)]])
> print A*B
Row or column; I can't remember which is which either. Try again with
B = matrix([[int(fr.readline())] for j in range(N)]
or
A*B.transpose()
Peter
More information about the Python-list
mailing list