Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Unexpected Results of 3D Not Inplace FFT

$
0
0

The following is my C code snipped illustrating a problem.

I set dim1/dim2/dim3 to all be the next higher power of 2 based on the lengths
of the actual input data.  My test that works has
all dims set to 1024 (not by design, it just happened that way).  I have
the data padded with 0s in all locations for the pad.

The routine works correctly for the above case.  I compare the values
created in the DftiComputeBackward call to the input data, and the differences
are at 10 to the minus 8.

However, when I increase just the dim2 amount to 2048, the output is virtually identical,
but the phase is 180 degrees off, i.e., the sign of the values are flipped.

The same holds true when I increase just dim3 to 2048, identical output except for
the signs.

Again, I am looking at the 'traceout' array created in DftiComputeBackward.

Thanks for any suggestions;

 

void doit( int dim2, int dim1, int dim3, float *tracein, float *traceout, complex *in_fft_c) {

  float back_scale;

  MKL_LONG istat;
  MKL_LONG size[3];
  MKL_LONG rs[4], cs[4];

  DFTI_DESCRIPTOR_HANDLE dfti;

  /* set sizes (includes pad) */
  size[0] = dim1;
  size[1] = dim2;
  size[2] = dim3;

  /* set scale for inverse fft */
  back_scale = 1.0/(dim1*dim2*dim3);

  /* set strides for out of place real and complex transforms */
  rs[3] = 1;
  rs[2] = dim3;
  rs[1] = dim2*dim3;
  rs[0] = 0;

  cs[3] = 1;
  cs[2] = dim3/2+1;
  cs[1] = dim2*(dim3/2+1);
  cs[0] = 0;

  istat  = DftiCreateDescriptor( &dfti, DFTI_SINGLE, DFTI_REAL, 3, size );
  istat += DftiSetValue( dfti, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX );
  istat += DftiSetValue( dfti, DFTI_PLACEMENT, DFTI_NOT_INPLACE  );
  istat += DftiSetValue( dfti, DFTI_OUTPUT_STRIDES , cs  );
  istat += DftiCommitDescriptor( dfti );

  istat += DftiComputeForward  ( dfti, tracein , in_fft_c  );

  istat += DftiSetValue( dfti, DFTI_INPUT_STRIDES  , cs  );
  istat += DftiSetValue( dfti, DFTI_OUTPUT_STRIDES , rs  );
  istat += DftiSetValue (dfti, DFTI_BACKWARD_SCALE, back_scale);
  istat += DftiCommitDescriptor( dfti );

  istat += DftiComputeBackward ( dfti, in_fft_c, traceout );

  istat += DftiFreeDescriptor(&dfti);

}


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>