dct_1d: Compute 1D Discrete Cosine Transform

View source: R/kernel_regression_estimator.R

dct_1dR Documentation

Compute 1D Discrete Cosine Transform

Description

This function computes the Type-II discrete cosine transform.

Usage

dct_1d(X)

Arguments

X

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

Details

The Type-II discrete cosine transform is obtained using stats::fft. If X is of length N, construct a new signal Y of length 4N, with values Y_{2n} = 0, Y_{2n + 1} = x_{n} for 0 \le n < N, and Y_{2N} = 0, Y_{4N - n} = y_{n} for 0 < n < 2N. After this, the Type-II discrete cosine transform is computed by 0.5 * Re(stats::fft(Y))[1:(length(Y) / 4)].

Value

A vector of discrete cosine transform values.

References

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

Makhoul, J. (1980). A Fast Cosine Transform in One and Two Dimensions. IEEE Transactions on Acoustics, Speech, and Signal Processing 28(1), 27-34. https://doi.org/10.1109/TASSP.1980.1163351

StasiƄski, R. (2002). DCT Computation Using Real-Valued DFT Algorithms. Proceedings of the 11th European Signal Processing Conference.

Examples

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

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

Related to dct_1d in CovEsts...