[SciPy-user] Inverting Complex64 array fails on OS X

Andre Radke lists at spicynoodles.net
Mon Jan 16 13:47:08 CST 2006

Travis Oliphant wrote:
>Andre Radke wrote:
>  >The dtypechar attribute of my Complex64 matrix was 'G'.
>This is definitely the problem.  It should be 'D'.  'G' is a complex
>number with long doubles.
>How did you specify the matrix again?   Could you show us some of the
>attributes of the matrix you created.  I'm shocked that 'G' was the

jannu:/Volumes/Data/Diploma/code/py-smatrix andre$ /usr/local/bin/python
ActivePython 2.4.2 Build 248 (ActiveState Corp.) based on
Python 2.4.2 (#1, Oct  3 2005, 09:39:46)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  from scipy import *
>>>  a = array([[1, 1], [-1, -1j]], dtype=Complex64)
>>>  a
array([[ 1.+0.j,  1.+0.j],
        [-1.+0.j,  0.-1.j]], dtype=complex128)
>>>  a_inv = linalg.inv(a)
>>>  a_inv
array([[ 0., -1.],
        [ 1.,  1.]])
>>>  dot(a, a_inv)
array([[ 1.+0.j,  0.+0.j],
        [ 0.-1.j,  1.-1.j]], dtype=complex128)
>>>  a.shape
(2, 2)
>>>  a.real
array([[ 1.,  1.],
        [-1.,  0.]], dtype=float64)
>>>  a.imag  
array([[ 0.,  0.],
        [ 0., -1.]], dtype=float64)
>>>  a.dtypechar
>>>  a.dtypedescr
>>>  a.dtype
<type 'complex128_arrtype'>
>>>  Complex64

This is on an Apple PowerBook G3 (pre-Altivec) running Mac OS X 
10.3.9 with ActivePython 2.4.2, NumPy and SciPy 
compiled per Chris Fonnesbeck's instructions on new.scipy.org.

If you think I may have run into a bug and there's something else you 
would like me to try, just let me know...

>  >Also, is Complex64 the preferred way to specify a double precision
>  >complex dtype when constructing a matrix?
>No.  Use numpy.complex128  or 'D' or just simply complex.

Thanks, using complex solved my actual problem and got my project unstuck.


More information about the SciPy-user mailing list