Function irfft
pub fn irfft<const D: usize>(
spectrum_re: Tensor<D>,
spectrum_im: Tensor<D>,
dim: impl AsIndex,
n: Option<usize>,
) -> Tensor<D>Expand description
Computes the 1-dimensional inverse discrete Fourier Transform for real-valued signals.
This function reconstructs the real-valued time-domain signal from the
first non-redundant values ($N/2 + 1$) of the frequency-domain spectrum.
Autodiff is supported when the autodiff feature is enabled.
x[n] = (1/N) * Σ X[k] * exp(i*2πkn/N)
§Arguments
spectrum_re- The real part of the spectrum.spectrum_im- The imaginary part of the spectrum.dim- The dimension along which to take the inverse FFT. Negative dimensions are supported and count from the end.n- Optional output signal length. WhenNone, the reconstructed signal length2 * (size - 1)must be a power of two. WhenSome(n),nmust also be a power of two and the output has exactlynsamples. Non-power-of-twonis rejected.
§Returns
The reconstructed real-valued signal.
§Example
use burn_core::tensor::Tensor;
let device = Default::default();
let real = Tensor::<1>::from_floats([10.0, -2.0, 2.0], &device);
let imag = Tensor::<1>::from_floats([0.0, 2.0, 0.0], &device);
let signal = burn_signal::irfft(real, imag, 0, None);