Skip to content

Commit

Permalink
generalise %pp_def slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Mar 22, 2021
1 parent e41e602 commit 3693618
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions FFTW3.pd
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ sub irfftn { _rank_springboard( "irfft", @_ ) }
*PDL::irfftn = \&irfftn;

EOF
pp_add_exported( map { "${_}fftn" } ('','i','r','ir') );
pp_add_exported( map "${_}fftn", '','i','r','ir' );

pp_done();

Expand All @@ -127,30 +127,26 @@ sub generateDefinitions
{
my $rank = shift;

my %pp_def = (
HandleBad => 0,
GenericTypes => [qw(F D)],
OtherPars => 'IV plan', # comes from pre-fft code not user
# this is a private function so I don't want to create
# user-visible documentation or exports
Doc => undef,
PMFunc => ''
);

################################################################################
####### first I generate the definitions for the simple complex-complex FFT case
my $funcname = "__fft$rank";

# make dimension string 'n0=2,n1,n2,n3,n4...'. The leading 2 is for the
# (real,imag) complex pair
my @dims = map {"n$_"} 1..$rank;
my @dims = map "n$_", 1..$rank;
unshift @dims, 'n0=2';
my $dims_string = join(',', @dims);

my %pp_def = ( HandleBad => 0,
Pars => "in($dims_string); [o]out($dims_string);",
GenericTypes => [qw(F D)],
Code => slurp('template_complex.c'),
OtherPars => 'IV plan', # comes not from the user, but
# from the pre-fft code

# this is a private function so I don't want to create
# user-visible documentation or exports
Doc => undef,
PMFunc => ''
);
pp_def( $funcname, %pp_def );

$pp_def{Pars} = "in($dims_string); [o]out($dims_string);";
$pp_def{Code} = slurp('template_complex.c');
pp_def( "__fft$rank", %pp_def );


##################################################################################
Expand Down

0 comments on commit 3693618

Please sign in to comment.