help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] gsl_complex to fftw_complex type


From: Chia-Hung Lin
Subject: Re: [Help-gsl] gsl_complex to fftw_complex type
Date: Thu, 16 Aug 2007 10:19:27 +0800

2007/8/15, Oliver Jennrich <address@hidden>:
> On 8/15/07, Eric Germaneau <address@hidden> wrote:
> > Hello,
> >
> > I wondering whether its possible to convert gsl_complex to fftw_complex
> > type.
>
> Well, gsl_complex is defined as
>
> typedef struct
>   {
>     double dat[2];
>   }
> gsl_complex;
>
> whereas fftw_complex is either directly defined as _complex double or
> as double[2].
>
> In any event, fftw_complex should be bit compatible with gsl_complex,
> so a simple typecasting should do it.
>

So is it safe to use the following method ?

gsl_complex *a;
fftw_complex *b;
a = new gsl_complex[10];
b = reinterpret_cast<fftw_complex*>(a);

I tried this cast and it seemed to work, but I still want to be sure
that it's safe to do so.

Any comment would be very appreciated.

-- 
Chia-Hung Lin
Institute of Photonics and Optoelectronics, National Taiwan University




reply via email to

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