Learn R Programming

torch (version 0.8.1)

torch_fft_irfft: Irfft

Description

Computes the inverse of torch_fft_rfft(). Input is interpreted as a one-sided Hermitian signal in the Fourier domain, as produced by torch_fft_rfft(). By the Hermitian property, the output will be real-valued.

Usage

torch_fft_irfft(self, n = NULL, dim = -1L, norm = NULL)

Arguments

self

(Tensor) the input tensor representing a half-Hermitian signal

n

(int) Output signal length. This determines the length of the output signal. If given, the input will either be zero-padded or trimmed to this length before computing the real IFFT. Defaults to even output: n=2*(input.size(dim) - 1).

dim

(int, optional) – The dimension along which to take the one dimensional real IFFT.

norm

(str, optional) – Normalization mode. For the backward transform, these correspond to:

  • "forward" - no normalization

  • "backward" - normalize by 1/n

  • "ortho" - normalize by 1/sqrt(n) (making the real IFFT orthonormal) Calling the forward transform (torch_fft_rfft()) with the same normalization mode will apply an overall normalization of 1/n between the two transforms. This is required to make irfft() the exact inverse. Default is "backward" (normalize by 1/n).

Examples

Run this code
if (torch_is_installed()) {
t <- torch_arange(start = 0, end = 4)
x <- torch_fft_rfft(t)
torch_fft_irfft(x)
torch_fft_irfft(x, n = t$numel())

}

Run the code above in your browser using DataLab