jax.scipy.fft.dct(x, type=2, n=None, axis=- 1, norm=None)[source]#

Return the Discrete Cosine Transform of arbitrary type sequence x.

LAX-backend implementation of scipy.fft._realtransforms.dct().

Original docstring below.

  • x (array_like) – The input array.

  • type ({1, 2, 3, 4}, optional) – Type of the DCT (see Notes). Default type is 2.

  • n (int, optional) – Length of the transform. If n < x.shape[axis], x is truncated. If n > x.shape[axis], x is zero-padded. The default results in n = x.shape[axis].

  • axis (int, optional) – Axis along which the dct is computed; the default is over the last axis (i.e., axis=-1).

  • norm ({"backward", "ortho", "forward"}, optional) – Normalization mode (see Notes). Default is “backward”.


y – The transformed input array.

Return type

ndarray of real



‘A Fast Cosine Transform in One and Two Dimensions’, by J. Makhoul, IEEE Transactions on acoustics, speech and signal processing vol. 28(1), pp. 27-34, DOI:10.1109/TASSP.1980.1163351 (1980).


Wikipedia, “Discrete cosine transform”, https://en.wikipedia.org/wiki/Discrete_cosine_transform