bounds.realtransforms
This module implements discrete transforms for real signals:
The implementations relies on the FFT under-the-hood, with memory-saving
tricks (borrowed from cupy).
The table belows lists all functions implemented in the module.
In addition to these, wrappers of the form
FUNCTYPE = partial(FUNC, type=TYPE) are defined. For example:
| FUNCTION | DESCRIPTION |
|---|---|
dct |
One-dimensional Discrete Cosine Transform (DCT) |
dst |
One-dimensional Discrete Sine Transform (DST) |
idct |
One-dimensional Inverse Discrete Cosine Transform (DCT) |
idst |
One-dimensional Inverse Discrete Sine Transform (DST) |
dctn |
N-dimensional Discrete Cosine Transform (IDCT) |
dstn |
N-dimensional Discrete Sine Transform (IDST) |
idctn |
N-dimensional Inverse Discrete Cosine Transform (IDCT) |
idstn |
N-dimensional Inverse Discrete Sine Transform (IDST) |
``` |
|
dct
Return the Discrete Cosine Transform
Type IV not implemented
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. Default is the last one.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
idct
Return the Inverse Discrete Cosine Transform
Warning
Type IV not implemented
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. Default is the last one.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
dst
Return the Discrete Sine Transform
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.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. Default is the last one.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
idst
Return the Inverse Discrete Sine Transform
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.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. Default is the last one.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
dctn
Return multidimensional Discrete Cosine Transform along the specified axes.
Type IV not implemented
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. If not given, all dimensions are used.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
idctn
Return multidimensional Inverse Discrete Cosine Transform along the specified axes.
Type IV not implemented
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. If not given, all dimensions are used.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
dstn
Return multidimensional Discrete Sine Transform along the specified axes.
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.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. If not given, all dimensions are used.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|
Source code in bounds/realtransforms.py
idstn
Return multidimensional Inverse Discrete Sine Transform along the specified axes.
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.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The input tensor
TYPE:
|
dim |
Dimensions over which the DCT is computed. If not given, all dimensions are used.
TYPE:
|
norm |
Normalization mode. Default is "backward".
TYPE:
|
type |
Type of the DCT. Default type is 2.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
y
|
The transformed tensor.
TYPE:
|