Skip to content

Commit

Permalink
change param names from "complex" which clashes with complex.h
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 21, 2021
1 parent 09264bb commit fb01735
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- change param names from "complex" which clashes with complex.h

0.06: 2019-12-09
- add licence info - thanks @manwar

Expand Down
8 changes: 4 additions & 4 deletions FFTW3.pd
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ sub generateDefinitions
# forward
# I have the real dimensions, but not nhalf
$pp_def{RedoDimsCode} = <<'EOF';
if( $PDL(complex)->ndims <= 1 || $PDL(complex)->dims[1] <= 0 )
if( $PDL(complexv)->ndims <= 1 || $PDL(complexv)->dims[1] <= 0 )
$SIZE(nhalf) = (int)( $PDL(real)->dims[0]/2 ) + 1;
EOF
$pp_def{Pars} = "real($dims_real_string); [o]complex($dims_complex_string);";
$pp_def{Pars} = "real($dims_real_string); [o]complexv($dims_complex_string);";
$pp_def{Code} = $code_real_forward;
pp_def( "__rfft$rank", %pp_def );

Expand All @@ -182,9 +182,9 @@ EOF
# $out->dim(0) = 2*$in->dim(1) - 2
$pp_def{RedoDimsCode} = <<'EOF';
if( $PDL(real)->dims[0] <= 0 )
$SIZE(n1) = 2*$PDL(complex)->dims[1] - 2;
$SIZE(n1) = 2*$PDL(complexv)->dims[1] - 2;
EOF
$pp_def{Pars} = "complex($dims_complex_string); [o]real($dims_real_string);";
$pp_def{Pars} = "complexv($dims_complex_string); [o]real($dims_real_string);";
$pp_def{Code} = $code_real_backward;
pp_def( "__irfft$rank", %pp_def );
}
Expand Down
6 changes: 3 additions & 3 deletions template_real.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
if( !INVERSE )
$TFD(fftwf_,fftw_)execute_dft_r2c( plan,
($TFD(float,double)*)$P(real),
($TFD(fftwf_,fftw_)complex*)$P(complex) );
($TFD(fftwf_,fftw_)complex*)$P(complexv) );
else
{
// FFTW inverse real transforms clobber their input. I thus make a new
// buffer and transform from there
unsigned long nelem = 1;
for( int i=0; i<=RANK; i++ )
nelem *= $PDL(complex)->dims[i];
nelem *= $PDL(complexv)->dims[i];
$GENERIC()* input_copy = $TFD(fftwf_,fftw_)alloc_real( nelem );
memcpy( input_copy, $P(complex), sizeof($GENERIC()) * nelem );
memcpy( input_copy, $P(complexv), sizeof($GENERIC()) * nelem );

$TFD(fftwf_,fftw_)execute_dft_c2r( plan,
($TFD(fftwf_,fftw_)complex*)input_copy,
Expand Down

0 comments on commit fb01735

Please sign in to comment.