Thanks!  This looks like a simple inheritance error: the FFTW routines should 
be checking for isa rather than checking the ref string.

(Mobile)

> On Aug 20, 2016, at 10:22 AM, Luis Mochan <[email protected]> wrote:
> 
> I found a slight inconvenience when using FFTW3 and the PDL::Complex data
> types. Subroutines such as fft1 or ifft1 expect PDL's with a first
> dimension 2 corresponding to the real and imaginary
> parts. PDL::Complex is a type derived from PDL whose first dimension
> is 2, but fft1 won't accept it. For example
>    pdl> use PDL::FFTW3
>    pdl> $a=sequence(2,10)
>    pdl> $b=ifft1($a)
> works without complain, but
>    pdl> $a=sequence(2,10)->complex
>    pdl> $b=ifft1($a)
>    ifft1 arguments must be of type 'PDL'. Instead I got an arg of
>    type 'PDL::Complex'. Giving up.
>    at 
> /home/mochan/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/PDL/FFTW3.pm
>  line 617.
>         PDL::FFTW3::validateArguments(1, "", "i", "ifft1", 
> PDL::Complex=SCALAR(0x2d9fb10), PDL=SCALAR(0x22ae308)) called at 
> /home/mochan/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/PDL/FFTW3.pm
>  line 544
>             PDL::FFTW3::__fft_internal("ifft1", 
> PDL::Complex=SCALAR(0x2d9fb10)) called at 
> /home/mochan/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux/PDL/FFTW3.pm
>  line 910
>                 PDL::FFTW3::ifft1(PDL::Complex=SCALAR(0x2d9fb10)) called at 
> (eval 68) line 4
>    ...
> fails, as the routine expected a PDL and got a PDL::Complex.
> Nevertheless, a PDL::Complex is a PDL:
>    pdl> p $a->isa('PDL')
>    1
> For the user the problem may be solved by using the 'real' and
> 'complex' or 'cplx' routines from PDL::Complex before and after doing
> the transforms, but it may lead to errors if the user forgets to
> convert back to complex before doing further complex operations on the
> Fourier transformed data.  
> 
> Regards,
> Luis
> 
> -- 
> 
>                                                                  o
> W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
> Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
> Apdo. Postal 48-3, 62251             |                           (*)/\/  \
> Cuernavaca, Morelos, México          | [email protected]   /\_/\__/
> GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
> 
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> pdl-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pdl-general
> 
------------------------------------------------------------------------------
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to