I want to use FFTW to calculate a power spectrum of a signal. Using the real transforms (in <rfftw.h>) I can simply calculate the discrete fourier transforms for the sine- and cosine-functions, square the elements and add them together respectively. Or I can calculate the complex one-dimensional transform and take the norm of each element.
I was wondering if there is a better way of calculating the power spectrum directly. I looked in the FFTW reference, but didn't find a dedicated power-spectrum-function. Maybe I am splitting hairs here, but I was thinking maybe there is a dedicated algorithm that calculates the power in each frequency more efficiently since I don't need the phase-information at all. Calculating both components (sine and cosine coeficients, or real and imaginary parts) and then throwing away one seems kind of inefficient.