[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Extracting real/imag parts of complex vectors and matrice

From: James Bergstra
Subject: Re: [Help-gsl] Extracting real/imag parts of complex vectors and matrices
Date: Fri, 8 Jul 2005 14:42:27 -0400
User-agent: Mutt/1.4.1i

Vectors and matrices are two different structures...

You can get the real or imaginary part of a complex vector by playing
with the data and stride members:

gsl_vector_complex * c;
gsl_vector r;
gsl_vector i; =;
r.stride = c.stride * 2; = + 1;
i.stride = c.stride * 2;

i.size = r.size = c.size;

The matrix is a bit tougher, because the matrix structure depends on one
of the dimensions being stored contiguously in memory.  A complex matrix
interleaves the real and complex components, so you'll have to copy the
real/imaginary parts out into a normal gsl_matrix.


On Fri, Jul 08, 2005 at 01:04:51PM -0500, Tyler Brown wrote:
> Hi,
> Does anyone know if there is a gsl function that returns the real (or 
> imaginary) part of complex vectors and matrices?  Of course a macro can be 
> used for a scalar and a function can be written but I would think someone 
> would have done this.
> Thanks in advance,
> Tyler
> Tyler Brown, Senior Engineer
> Research and Development
> Zenith Electronics
> Tel: (847) 941-8797
> Fax: (847) 941-8555
> _______________________________________________
> Help-gsl mailing list
> address@hidden

james bergstra

reply via email to

[Prev in Thread] Current Thread [Next in Thread]