Skip to content

nitorch_fastmath.realtransforms

dct

dct(x, dim=-1, norm='backward', type=2)

Return the Discrete Cosine Transform

Warning

Type IV not implemented

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim int

Dimensions over which the DCT is computed. Default is the last one.

-1
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

idct

idct(x, dim=-1, norm='backward', type=2)

Return the Inverse Discrete Cosine Transform

Warning

Type IV not implemented

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim int

Dimensions over which the DCT is computed. Default is the last one.

-1
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

dst

dst(x, dim=-1, norm='backward', type=2)

Return the Discrete Sine Transform

Warning

Type IV not implemented

Warning

dst(..., norm="ortho") yields a different result than scipy and cupy for types 2 and 3. This is because their DST is not properly orthogonalized. Use norm="ortho_scipy" to get results matching their implementation.

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim int

Dimensions over which the DCT is computed. Default is the last one.

-1
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

idst

idst(x, dim=-1, norm='backward', type=2)

Return the Inverse Discrete Sine Transform

Warning

Type IV not implemented

Warning

idst(..., norm="ortho") yields a different result than scipy and cupy for types 2 and 3. This is because their DST is not properly orthogonalized. Use norm="ortho_scipy" to get results matching their implementation.

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim int

Dimensions over which the DCT is computed. Default is the last one.

-1
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

dctn

dctn(x, dim=None, norm='backward', type=2)

Return multidimensional Discrete Cosine Transform along the specified axes.

Warning

Type IV not implemented

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim [sequence of] int

Dimensions over which the DCT is computed. If not given, all dimensions are used.

None
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

idctn

idctn(x, dim=None, norm='backward', type=2)

Return multidimensional Inverse Discrete Cosine Transform along the specified axes.

Warning

Type IV not implemented

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim [sequence of] int

Dimensions over which the DCT is computed. If not given, all dimensions are used.

None
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

dstn

dstn(x, dim=None, norm='backward', type=2)

Return multidimensional Discrete Sine Transform along the specified axes.

Warning

Type IV not implemented

Warning

dstn(..., norm="ortho") yields a different result than scipy and cupy for types 2 and 3. This is because their DST is not properly orthogonalized. Use norm="ortho_scipy" to get results matching their implementation.

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim [sequence of] int

Dimensions over which the DCT is computed. If not given, all dimensions are used.

None
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.

idstn

idstn(x, dim=None, norm='backward', type=2)

Return multidimensional Inverse Discrete Sine Transform along the specified axes.

Warning

Type IV not implemented

Warning

idstn(..., norm="ortho") yields a different result than scipy and cupy for types 2 and 3. This is because their DST is not properly orthogonalized. Use norm="ortho_scipy" to get results matching their implementation.

Parameters:

Name Type Description Default
x tensor

The input tensor

required
dim [sequence of] int

Dimensions over which the DCT is computed. If not given, all dimensions are used.

None
norm Literal['backward', 'ortho', 'forward']

Normalization mode. Default is “backward”.

“backward”
type Literal[1, 2, 3]

Type of the DCT. Default type is 2.

2

Returns:

Name Type Description
y tensor

The transformed tensor.