soumith/torch-signal — pull request #3 by fidlej (2014-09-23 09:54:21+00:00)
Title: Preserved the input when running irfft.

By default, fftw is [not preserving](http://www.fftw.org/doc/Planner-Flags.html) the input when running a c2r operation:

> FFTW_PRESERVE_INPUT specifies that an out-of-place transform must not change its input array. This is ordinarily the default, except **for c2r and hc2r** (i.e. complex-to-real) transforms for which **FFTW_DESTROY_INPUT is the default**. In the latter cases, passing FFTW_PRESERVE_INPUT will attempt to use algorithms that do not destroy the input, at the expense of worse performance; for multi-dimensional c2r transforms, however, no input-preserving algorithms are implemented and the planner will return NULL if one is requested.

I used the PRESERVE_INPUT flag for the 1D irfft.
And I used a copy of the input for the 2D irfft2.

I guess it is intended to preserve the input.