[Numpy-discussion] Construct a large n-dimensional complex matrix
Jochen Schroeder
cycomanic at gmail.com
Tue Apr 7 20:10:08 EDT 2009
On 06/04/09 21:20, Robert Kern wrote:
> On Mon, Apr 6, 2009 at 20:53, Nathan Faggian <nfaggian at unimelb.edu.au> wrote:
> > HI,
> > I want to construct a large complex matrix, I have the real and imaginary
> > components as double vectors, is there a fast way to construct a complex
> > vector in numpy?
>
> C = np.empty((n,m), dtype=complex)
> C.real.flat[:] = real_values
> C.imag.flat[:] = imag_values
>
Just a question, is there any advantage to doing
C = 1.j *imag_values + real_values
?
Cheers
Jochen
> --
> 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
> Numpy-discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list