Calling Sequence

Arguments

a real or complex vector or real or complex array
(vector, matrix or N-D array.

X

a real or complex array with same shape as A.

sign

an integer. with possible values 1 or
-1. Select direct or inverse
transform. The default value is -1
(direct transform).

selection

a vector containing index on A array
dimensions. See the Description part for details.

dims

a vector of positive numbers with integer values, or a
vector of positive integers. See the Description part for details.

Each element must be a divisor
of the total number of elements of A.

The product of the elements must be less than the total
number of elements of A.

incr

a vector of positive numbers with integer values, or a
vector of positive integers. See the Description part for
details.

incr must have the same number of
elements than dims.

Each element must be a divisor of the total number of
elements of A.

The incr elements must be in strictly
increasing order.

option

a character string. with possible values
"dct1", "dct2",
"dct4" or "dct" for
direct transform and "dct1",
"dct3", "dct4" or
"idct" for inverse transform. The
default value is "dct" for direct
transform and "idct" for inverse
transform. See the Description part for details.

Description

Transform description

This function realizes direct or
inverse 1-D or N-D Discrete Cosine Transforms with shift depending on the option parameter value. For a 1-D array of length :

For "dct1" the function computes the unnormalized DCT-I transform:

For "dct2" the function computes the unnormalized DCT-II transform:

For "dct3" the function computes the unnormalized DCT-III transform:

For "dct4" the function computes the unnormalized DCT-IV transform:

For "dct" the function computes the normalized DCT-II transform:

For "idct" the function computes the normalized DCT-III transform:

The multi-dimensional DCT transforms , in general, are the
separable product of the given 1d transform along each dimension
of the array. For unnormalized transforms , computing the
forward followed by the backward/inverse multi-dimensional
transform will result in the original array scaled by the
product of the dimension sizes.

The normalized multi-dimensional DCT transform of an array
A with dimensions
is given by

The normalized multi-dimensional DCT inverse transform of an
array A with dimensions is given by

Syntax description

Short syntax

direct

X=dct(A,-1 [,option]) or
X=dct(A [,option]) gives a direct
transform according to the option value. The default is normalized DCT-II direct transform.

If A is a vector (only one
dimension greater than 1) a 1-d transform is performed
and in the other cases a n-dimensional transform is
done.

(the -1 argument refers
to the sign of the exponent..., NOT to
"inverse"),

X=dct(A,sign,dims,incr) is
an old syntax that also allows to perform all direct or
inverse dct of the slices of A along
selected dimensions.

For example, if A is an array with
n1*n2*n3 elements
X=dct(A,-1,n1,1) is equivalent to
X=dct(matrix(A,[n1,n2,n3]),-1,1).
and X=dct(A,-1,[n1 n3],[1 n1*n2])
is equivalent to
X=dct(matrix(A,[n1,n2,n3]),-1,[1,3]).

Optimizing dct

Remark: function automatically stores his last parameters in
memory to re-use it in a second time. This improves greatly
the time computation when consecutives calls (with same
parameters) are performed.