Note that there are some explanatory texts on larger screens.

plurals
  1. POFFTW: Inverse of forward fft not equal to original function
    primarykey
    data
    text
    <p>I'm trying to use FFTW to compute fast summations, and I've run into an issue: </p> <pre><code>int numFreq3 = numFreq*numFreq*numFreq; FFTW_complex* dummy_sq_fft = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_complex* dummy_sq = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_complex* orig = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_plan dummyPlan = FFTW_plan_dft_3d( numFreq, numFreq, numFreq, orig, dummy_sq_fft, FFTW_FORWARD, FFTW_MEASURE ); FFTW_plan dummyInvPlan = FFTW_plan_dft_3d( numFreq, numFreq, numFreq, dummy_sq_fft, dummy_sq, FFTW_BACKWARD, FFTW_MEASURE ); for(int i= 0; i &lt; numFreq3; i++) { orig[ i ][ 0 ] = sparseProfile02[ 0 ][ i ][ 0 ]; //img. part == 0 orig[ i ][ 1 ] = sparseProfile02[ 0 ][ i ] [ 1 ]; } FFTW_execute(dummyPlan); FFTW_execute(dummyInvPlan); int count = 0; for(int i=0; i&lt;numFreq3; i++) { double factor = dummy_sq[ i ][ 0 ]/sparseProfile02[ 0 ][ i ][ 0 ]; if(factor &lt; 0) { count++; } } std::cout&lt;&lt;"Count "&lt;&lt;count&lt;&lt;"\n"; FFTW_free(dummy_sq_fft); FFTW_free(dummy_sq); FFTW_destroy_plan(dummyPlan); FFTW_destroy_plan(dummyInvPlan); </code></pre> <p>(Here sparseProfile02[0] is of type FFTW_complex*, and contains only positive real data.)</p> <p>Since we have dummy_sq = IFFT(FFT(sparseProfile02[ 0 ])), we must have dummy_sq = n^3*sparseProfile02. But this is true only some of the time; in fact, values on the dummy_sq grid are negative whenever corresponding values on the sparseProfile02 grid are zero (but not vice-versa). Does anyone know why this is happening?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload