On Wed, Nov 19, 2008 at 07:15, Neal Becker <[EMAIL PROTECTED]> wrote: > What's the best way to convert a pair of real arrays representing real and > imag parts to a complex array?
What do you mean by "best"? Easiest to type? Easiest to read? Fastest? Memory efficient? Ideally, they'd all be the same, but alas, they are not. Here are two possibilities: z = real +1j*imag z = np.empty(real.shape, complex) z.real = real z.imag = imag You can wrap the latter into a function, and then you probably would have the best of both worlds. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
