Function irfft
pub fn irfft<B, const D: usize>(
spectrum_re: Tensor<B, D>,
spectrum_im: Tensor<B, D>,
dim: usize,
n: Option<usize>,
) -> Tensor<B, D>where
B: Backend,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. For now, the autodiff is not yet supported.
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.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_tensor::backend::Backend;
use burn_tensor::Tensor;
fn example<B: Backend>() {
let device = B::Device::default();
let real = Tensor::<B, 1>::from_floats([10.0, -2.0, 2.0], &device);
let imag = Tensor::<B, 1>::from_floats([0.0, 2.0, 0.0], &device);
let signal = burn_tensor::signal::irfft(real, imag, 0, None);
}