FFT.pm (PDL-2.082) | : | FFT.pm (PDL-2.083) | ||
---|---|---|---|---|

skipping to change at line 100 | skipping to change at line 100 | |||

However, unlike PDL::FFT, these modules are optional, | However, unlike PDL::FFT, these modules are optional, | |||

and so may not be installed. | and so may not be installed. | |||

=cut | =cut | |||

#line 103 "FFT.pm" | #line 103 "FFT.pm" | |||

=head1 FUNCTIONS | =head1 FUNCTIONS | |||

=cut | =cut | |||

#line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

=head2 fft | =head2 fft | |||

=for sig | =for sig | |||

Signature: ([io]real(n); [io]imag(n)) | Signature: ([io]real(n); [io]imag(n)) | |||

=for ref | =for ref | |||

Complex 1-D FFT of the "real" and "imag" arrays [inplace]. A single | Complex 1-D FFT of the "real" and "imag" arrays [inplace]. A single | |||

cfloat/cdouble input ndarray can also be used. | cfloat/cdouble input ndarray can also be used. | |||

skipping to change at line 124 | skipping to change at line 122 | |||

fft($real,$imag); | fft($real,$imag); | |||

fft($complex); | fft($complex); | |||

=for bad | =for bad | |||

fft does not process bad values. | fft does not process bad values. | |||

It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||

=cut | =cut | |||

#line 145 "FFT.pm" | ||||

#line 959 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

sub PDL::fft { | sub PDL::fft { | |||

# Convert the first argument to decimal and check for trouble. | # Convert the first argument to decimal and check for trouble. | |||

my ($re, $im) = @_; | my ($re, $im) = @_; | |||

if (!$re->type->real) { | if (!$re->type->real) { | |||

$im=$re->im; | $im=$re->im; | |||

$re=$re->re; | $re=$re->re; | |||

} | } | |||

eval { todecimal($re); }; | eval { todecimal($re); }; | |||

if ($@) { | if ($@) { | |||

skipping to change at line 156 | skipping to change at line 151 | |||

if ($message =~ /undefined value/); | if ($message =~ /undefined value/); | |||

barf($message); | barf($message); | |||

} | } | |||

PDL::_fft_int($re,$im); | PDL::_fft_int($re,$im); | |||

if (!$_[0]->type->real) { | if (!$_[0]->type->real) { | |||

$_[0]= czip($re, $im); | $_[0]= czip($re, $im); | |||

} else { | } else { | |||

$_[0]=$re,$_[1]=$im; | $_[0]=$re,$_[1]=$im; | |||

} | } | |||

} | } | |||

#line 179 "FFT.pm" | ||||

#line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

*fft = \&PDL::fft; | *fft = \&PDL::fft; | |||

#line 186 "FFT.pm" | ||||

#line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

=head2 ifft | =head2 ifft | |||

=for sig | =for sig | |||

Signature: ([io]real(n); [io]imag(n)) | Signature: ([io]real(n); [io]imag(n)) | |||

=for ref | =for ref | |||

Complex inverse 1-D FFT of the "real" and "imag" arrays [inplace]. A single | Complex inverse 1-D FFT of the "real" and "imag" arrays [inplace]. A single | |||

skipping to change at line 187 | skipping to change at line 176 | |||

ifft($real,$imag); | ifft($real,$imag); | |||

ifft($complex); | ifft($complex); | |||

=for bad | =for bad | |||

ifft does not process bad values. | ifft does not process bad values. | |||

It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||||

=cut | =cut | |||

#line 218 "FFT.pm" | ||||

#line 959 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

sub PDL::ifft { | sub PDL::ifft { | |||

# Convert the first argument to decimal and check for trouble. | # Convert the first argument to decimal and check for trouble. | |||

my ($re, $im) = @_; | my ($re, $im) = @_; | |||

if (!$re->type->real) { | if (!$re->type->real) { | |||

$im=$re->im; | $im=$re->im; | |||

$re=$re->re; | $re=$re->re; | |||

} | } | |||

eval { todecimal($re); }; | eval { todecimal($re); }; | |||

if ($@) { | if ($@) { | |||

skipping to change at line 219 | skipping to change at line 205 | |||

if ($message =~ /undefined value/); | if ($message =~ /undefined value/); | |||

barf($message); | barf($message); | |||

} | } | |||

PDL::_ifft_int($re,$im); | PDL::_ifft_int($re,$im); | |||

if (!$_[0]->type->real) { | if (!$_[0]->type->real) { | |||

$_[0]= czip($re, $im); | $_[0]= czip($re, $im); | |||

} else { | } else { | |||

$_[0]=$re,$_[1]=$im; | $_[0]=$re,$_[1]=$im; | |||

} | } | |||

} | } | |||

#line 252 "FFT.pm" | ||||

#line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | ||||

*ifft = \&PDL::ifft; | *ifft = \&PDL::ifft; | |||

#line 259 "FFT.pm" | ||||

#line 185 "fft.pd" | #line 185 "fft.pd" | |||

use Carp; | use Carp; | |||

use PDL::Core qw/:Func/; | use PDL::Core qw/:Func/; | |||

use PDL::Basic qw/:Func/; | use PDL::Basic qw/:Func/; | |||

use PDL::Types; | use PDL::Types; | |||

use PDL::ImageND qw/kernctr/; # moved to ImageND since FFTW uses it too | use PDL::ImageND qw/kernctr/; # moved to ImageND since FFTW uses it too | |||

use PDL::Ops qw/czip/; | use PDL::Ops qw/czip/; | |||

skipping to change at line 428 | skipping to change at line 410 | |||

barf "Must have image & kernel for fftconvolve" if $#_ != 1; | barf "Must have image & kernel for fftconvolve" if $#_ != 1; | |||

my ($im, $k) = map $_->r2C, @_; | my ($im, $k) = map $_->r2C, @_; | |||

fftnd($im); | fftnd($im); | |||

fftnd($k); | fftnd($k); | |||

my $c = $im * $k; | my $c = $im * $k; | |||

ifftnd($c); | ifftnd($c); | |||

$_[0] = $c->re->sever; | $_[0] = $c->re->sever; | |||

$_[1] = $c->im->sever; | $_[1] = $c->im->sever; | |||

@_; | @_; | |||

} | } | |||

#line 465 "FFT.pm" | ||||

#line 388 "fft.pd" | #line 388 "fft.pd" | |||

=head1 BUGS | =head1 BUGS | |||

Where the source is marked `FIX', could re-implement using phase-shift | Where the source is marked `FIX', could re-implement using phase-shift | |||

factors on the transforms and some real-space bookkeeping, to save | factors on the transforms and some real-space bookkeeping, to save | |||

some temporary space and redundant transforms. | some temporary space and redundant transforms. | |||

=head1 AUTHOR | =head1 AUTHOR | |||

This file copyright (C) 1997, 1998 R.J.R. Williams | This file copyright (C) 1997, 1998 R.J.R. Williams | |||

(rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au), | (rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au), | |||

Tuomas J. Lukka, (lukka@husc.harvard.edu). All rights reserved. There | Tuomas J. Lukka, (lukka@husc.harvard.edu). All rights reserved. There | |||

is no warranty. You are allowed to redistribute this software / | is no warranty. You are allowed to redistribute this software / | |||

documentation under certain conditions. For details, see the file | documentation under certain conditions. For details, see the file | |||

COPYING in the PDL distribution. If this file is separated from the | COPYING in the PDL distribution. If this file is separated from the | |||

PDL distribution, the copyright notice should be included in the file. | PDL distribution, the copyright notice should be included in the file. | |||

=cut | =cut | |||

#line 490 "FFT.pm" | #line 462 "FFT.pm" | |||

# Exit with OK status | # Exit with OK status | |||

1; | 1; | |||

End of changes. 10 change blocks. | ||||

21 lines changed or deleted | | 1 lines changed or added |