3

I'm taking a multidimensional discrete cosine transform (FFTW_REDFT11) in FFTW, and am unsure how to compute the scaling factor. According to the documentation, taking the forward and reverse transforms results in the original image multiplied by a scaling factor:

[C]omputing a transform followed by its inverse yields the original array scaled by N, where N is the logical DFT size. For REDFT00, N=2(n-1); for RODFT00, N=2(n+1); otherwise, N=2n.

The documentation also defines logical arrays for 1D transforms:

[I]f you specify a size-5 REDFT00 (DCT-I) of the data abcde, it corresponds to the DFT of the logical even array abcdedcb of size 8. A size-4 REDFT10 (DCT-II) of the data abcd corresponds to the size-8 logical DFT of the even array abcddcba, shifted by half a sample.

I'm not sure what n is in a multidimensional transform. Say I have a 10x10 matrix. Is n twice the total number of pixels (200)? Or is it the number of pixels in the image if it were reflected in all dimensions (400)?

1 Answers1

1

You're on the right track. The distinction must be made between the physical size of your array, n (generally $n_0 × n_1 × n_2 × … × n_{d-1}$ except for in-place R2C transforms), and the logical size, N. For a 10x10 matrix, the physical size is n=10*10=100, so the logical size for this particular transform is N=2n=200, the scaling factor for the unnormalized transform-then-inverse result.

They talk a little more about that here in the Real even/odd FFTW3 docs, although they don't give much more info than the link you provided.

It's always a good idea to test with a problem that you already know the answer to,