[Numpy-discussion] conversion to complex

Eric Hagemann ehagemann at home.com
Tue Mar 13 20:45:56 EST 2001


I have an array of floats that is an interleaved stream of complex (real/imag) values that I want to promote to complex.  My current method uses the following

a=array([1,2,3,4])

b = a[0:4:2] + cmath.sqrt(-1)*a[1:4:2]

Is there a more elegant way ?  I am hoping to avoid explicit for loops etc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20010313/aadf0412/attachment.html>


More information about the NumPy-Discussion mailing list