numpy help

Chris Smith mc_anjo at tamu.edu
Fri Nov 3 23:22:51 CET 2006


Howdy,

I'm a college student and for one of we are writing programs to
numerically compute the parameters of antenna arrays. I decided to use
Python to code up my programs. Up to now I haven't had a problem,
however we have a problem set where we are creating a large matrix and
finding it's inverse to solve the problem. To invert the matrix I've
tried using numpy.numarray.linear_algebra.inverse and
numpy.oldnumeric.linear_algebra.inverse which both give me the same
error ( I was hoping they called different routines but I think they
call the same one ).


This is the error message I receive:

Traceback (most recent call last):
    File "C:\Documents and Settings\Chris &
Esther\Desktop\636_hw5_2\elen636_hw5_2.py", line 60, in <module>
      matrix_inverse =
numpy.numarray.linear_algebra.generalized_inverse(matrix)
    File
"C:\Python25\lib\site-packages\numpy\oldnumeric\linear_algebra.py", line
59, in generalized_inverse
      return linalg.pinv(a, rcond)
    File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line
557, in pinv
      u, s, vt = svd(a, 0)
    File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line
485, in svd
      a = _fastCopyAndTranspose(t, a)
    File "C:\Python25\lib\site-packages\numpy\linalg\linalg.py", line
107, in _fastCopyAndTranspose
      cast_arrays = cast_arrays + (_fastCT(a.astype(type)),)
TypeError: can't convert complex to float; use abs(z)



I've tried inverting small complex matrices and it worked fine. Does
anyone know why it won't work for this larger matrix? Any ideas how I
can work around this problem and get the correct inverse matrix?

Chris

P.S. elen636_math.py is my personal library of functions I've create to
solve the problem while elen636_hw5_2.py is the program that I'm
actually running

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: elen636_math.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20061103/bf78bc0d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: elen636_hw5_2.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20061103/bf78bc0d/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: file:///C|/DOCUME%7E1/CHRIS%26%7E1/LOCALS%7E1/TEMP/nsmail-3.txt
URL: <http://mail.python.org/pipermail/python-list/attachments/20061103/bf78bc0d/attachment.txt>


More information about the Python-list mailing list