idct_1d: Compute 1D Inverse Discrete Cosine Transform

View source: R/kernel_regression_estimator.R

idct_1dR Documentation

Compute 1D Inverse Discrete Cosine Transform

Description

This function computes the inverse of the Type-II discrete cosine transform.

Usage

idct_1d(X)

Arguments

X

A vector of values for which the discrete cosine transform is being computed.

Details

The Type-II inverse discrete cosine transform is computed using stats::fft. For autocovariance function estimation, the spectrum is given in the input X and then an inverse FFT is applied.

The original spectrum, dct_full, from X is obtained as follows. First, the original sample Fourier spectrum is reconstructed using dct_full <- c(X, 0, -X[-1], 0, rev(X[-1])). After this, an inverse FFT is applied, idct <- Re(stats::fft(dct_full, inverse = TRUE)) * (2 / length(dct_full)), which gives the original function with additional zero-values at even indices. The zeroes are dropped, which gives the untransformed X.

Value

A vector with the inverse transform values.

References

Ochoa-Dominguez, H. & Rao, K.R. (2019). Discrete Cosine Transform, Second Edition. CRC Press. https://doi.org/10.1201/9780203729854

endolith (2013). Fast Cosine Transform via FFT. Signal Processing Stack Exchange. https://dsp.stackexchange.com/a/10606

Examples

X <- dct_1d(c(1, 2, 3))
idct_1d(X)

CovEsts documentation built on Sept. 10, 2025, 10:39 a.m.

Related to idct_1d in CovEsts...