@@ -47,14 +47,14 @@ $TFD(fftwf_,fftw_)plan plan = INT2PTR($TFD(fftwf_,fftw_)plan, $COMP(plan));
47
47
$TFD(fftwf_,fftw_)execute_dft_r2c(plan, (void*)$P(real), (void*)$P(complexv));
48
48
EOF
49
49
my $TEMPLATE_REAL_C2R = <<'EOF';
50
- // RANK is replaced with the rank of this transform
51
50
// make sure the PDL data type I'm using matches the FFTW data type
52
51
static_assert_fftw(sizeof($GENERIC()) == sizeof($TGC(fftwf_,fftw_)complex));
53
52
$TGC(fftwf_,fftw_)plan plan = INT2PTR($TGC(fftwf_,fftw_)plan, $COMP(plan));
54
53
// FFTW inverse real transforms clobber their input. I thus make a new
55
54
// buffer and transform from there
56
55
unsigned long nelem = 1;
57
- for( int i=0; i<=RANK; i++ )
56
+ PDL_Indx i, rank = $PRIV(vtable)->par_realdims[0];
57
+ for( i=0; i<rank; i++ )
58
58
nelem *= $PDL(complexv)->dims[i];
59
59
unsigned long elem_scale = sizeof($GENERIC()) / sizeof( $TGC(float,double) ); /* native complex */
60
60
void *input_copy = $TGC(fftwf_,fftw_)alloc_real( nelem * elem_scale );
@@ -760,7 +760,7 @@ if( $PDL(real)->dims[0] <= 0 )
760
760
$SIZE(n1) = 2*$PDL(complexv)->dims[0] - 2;
761
761
EOF
762
762
$pp_def{Pars} = "complexv($dims_complex_string); real [o]real($dims_real_string);";
763
- $pp_def{Code} = $TEMPLATE_REAL_C2R =~ s/RANK/$rank-1/gre ;
763
+ $pp_def{Code} = $TEMPLATE_REAL_C2R;
764
764
$pp_def{GenericTypes} = [qw(G C)];
765
765
pp_def( "__irNfft$rank", %pp_def );
766
766
}
0 commit comments