[PYTHON MATRIX-SIG] asarray and Complex?

Doug Heisterkamp drh@cherokee.unl.edu
Mon, 19 Aug 1996 13:10:33 -0500 (CDT)


asarray is not converting the array to a different type when the 
typecode is given:
>>> from Numeric import *
>>> a = arange(4)
>>> b = asarray(a,Complex32)
>>> b
0 1 2 3

Also, the Complex type code is not working for me, but Complex32 is:
>>> d = a.astype(Complex)
>>> d
 0.  1.  2.  3.
>>> d[0] = 1 -1j
>>> d
 1.  1.  2.  3.


>>> d = a.astype(Complex32)
>>> d
 (0.+0.j)  (1.+0.j)  (2.+0.j)  (3.+0.j)  (4.+0.j)  (5.+0.j)  (6.+0.j)
       (7.+0.j)  (8.+0.j)

Doug
drh@cherokee.unl.edu


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================