Re: [Numpy-discussion] reinterpret complex <-> float

2011-06-03 Thread Warren Weckesser
On Fri, Jun 3, 2011 at 1:46 PM, Neal Becker wrote: > Can I arrange to reinterpret an array of complex of length N as an array of > float of length 2N, and vice-versa? If so, how? > You can use the view() method (if the data is contiguous): In [14]: z = array([1.0+1j, 2.0+3j, 4, 9j]) In [15]:

Re: [Numpy-discussion] reinterpret complex <-> float

2011-06-03 Thread Robert Kern
On Fri, Jun 3, 2011 at 13:46, Neal Becker wrote: > Can I arrange to reinterpret an array of complex of length N as an array of > float of length 2N, and vice-versa?  If so, how? [~] |1> carr = np.arange(10, dtype=complex) [~] |2> carr array([ 0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j, 5.+0.j,

[Numpy-discussion] reinterpret complex <-> float

2011-06-03 Thread Neal Becker
Can I arrange to reinterpret an array of complex of length N as an array of float of length 2N, and vice-versa? If so, how? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion