Skip to main content

dct

Overloads

NameDescription
dct(const RealMatrix input, const List<integer> axes) -> RealMatrixDiscrete Cosine Transform
dct(const RealArray input, const List<integer> axes) -> RealArrayDiscrete Cosine Transform
dct(const RealArray input, const List<integer> axes, integer type, real normalization, bool ortho) -> RealArrayDiscrete Cosine Transform with full options
dct(const RealMatrix input, const List<integer> axes, integer type, real normalization, bool ortho) -> RealMatrixDiscrete Cosine Transform with full options

dct(const RealMatrix input, const List<integer> axes) -> RealMatrix

Discrete Cosine Transform

Performs discrete cosine transform with default parameters (type=II, normalization=1.0, ortho=true). Type II applies 1/sqrt(2) scaling which, combined with ortho=true, results in output scaled by sqrt(2*N) where N is the transform size along each axis.

Parameters

  • input: Real input matrix (Nx1 for 1D, NxM for 2D)
  • axes: Vector of axes to transform. For 1D (Nx1): use [0]. For 2D (NxM): use [0] for rows, [1] for columns, or [0,1] for full 2D DCT

Returns

Real output matrix with same shape as input

dct(const RealArray input, const List<integer> axes) -> RealArray

Discrete Cosine Transform

Performs discrete cosine transform with default parameters (type=II, normalization=1.0, ortho=true). Type II applies 1/sqrt(2) scaling which, combined with ortho=true, results in output scaled by sqrt(2*N) where N is the transform size along each axis.

Parameters

  • input: Real input array (Nx1 for 1D, NxM for 2D)
  • axes: Vector of axes to transform. For 1D (Nx1): use [0]. For 2D (NxM): use [0] for rows, [1] for columns, or [0,1] for full 2D DCT

Returns

Real output array with same shape as input

dct(const RealArray input, const List<integer> axes, integer type, real normalization, bool ortho) -> RealArray

Discrete Cosine Transform with full options

Performs discrete cosine transform with all custom parameters

Parameters

  • input: Real input array (Nx1 for 1D, NxM for 2D)
  • axes: Vector of axes to transform. For 1D (Nx1): use [0]. For 2D (NxM): use [0] for rows, [1] for columns, or [0,1] for full 2D DCT
  • type: DCT type (1-4). Type II and Type III are inverses of each other when using matching parameters.
  • normalization: Multiplicative scaling factor applied to output (default: 1.0). For round-trip recovery with ortho=true: use 1.0/sqrt(2N) for both DCT-II (type=2) forward and DCT-III (type=3) inverse, where N is the transform size. For 2D (NxM), the normalization=1.0/sqrt(2N2M).
  • ortho: If true, apply orthonormal scaling (default: true)

Returns

Real output array with same shape as input

dct(const RealMatrix input, const List<integer> axes, integer type, real normalization, bool ortho) -> RealMatrix

Discrete Cosine Transform with full options

Performs discrete cosine transform with all custom parameters.

Parameters

  • input: Real input matrix (Nx1 for 1D, NxM for 2D)
  • axes: Vector of axes to transform
  • type: DCT type (1-4). Type II and Type III are inverses of each other when using matching parameters.
  • normalization: Multiplicative scaling factor applied to output (default: 1.0). For round-trip recovery with ortho=true: use 1.0/sqrt(2N) for both DCT-II (type=2) forward and DCT-III (type=3) inverse, where N is the transform size. For 2D (NxM), the normalization=1.0/sqrt(2N2M).
  • ortho: If true, apply orthonormal basis scaling (default: true)

Returns

Real output matrix with same shape as input