Discrete Transforms¶
The cvxopt.fftw
module is an interface to the FFTW library and
contains routines for discrete Fourier, cosine, and sine transforms.
This module is optional, and only installed when the FFTW library is made
available during the CVXOPT installation.
Discrete Fourier Transform¶

cvxopt.fftw.
dft
(X)¶ Replaces the columns of a dense complex matrix with their discrete Fourier transforms: if
X
has \(n\) rows,\[X[k,:] := \sum_{j=0}^{n1} e^{2\pi j k \sqrt{1}/n} X[j,:], \qquad k=0,\ldots,n1.\]

cvxopt.fftw.
idft
(X)¶ Replaces the columns of a dense complex matrix with their inverse discrete Fourier transforms: if
X
has \(n\) rows,\[X[k,:] := \frac{1}{n} \sum_{j=0}^{n1} e^{2\pi j k \sqrt{1}/n} X[j,:], \qquad k=0,\ldots,n1.\]
The module also includes a discrete Ndimensional Fourier transform. The input matrix is interpreted as an Ndimensional matrix stored in columnmajor order. The discrete Ndimensional Fourier transform computes the corresponding onedimensional transform along each dimension. For example, the twodimensional transform applies a onedimensional transform to all the columns of the matrix, followed by a onedimensional transform to all the rows of the matrix.

cvxopt.fftw.
dftn
(X[, dims = X.size])¶ Replaces a dense complex matrix with its Ndimensional discrete Fourier transform. The dimensions of the Ndimensional matrix are given by the Ntuple
dims
. The twodimensional transform is computed asdftn(X, X.size)
.

cvxopt.fftw.
idftn
(X[, dims = X.size])¶ Replaces a dense complex Ndimensional matrix with its inverse Ndimensional discrete Fourier transform. The dimensions of the matrix are given by the tuple
dims
. The twodimensional inverse transform is computed asidftn(X, X.size)
.
Discrete Cosine Transform¶

cvxopt.fftw.
dct
(X[, type = 2])¶ Replaces the columns of a dense real matrix with their discrete cosine transforms. The second argument, an integer between 1 and 4, denotes the type of transform (DCTI, DCTII, DCTIII, DCTIV). The DCTI transform requires that the row dimension of
X
is at least 2. These transforms are defined as follows (for a matrix with \(n\) rows).\[\begin{split}\mbox{DCTI:} \qquad X[k,:] & := X[0,:] + (1)^k X[n1,:] + 2 \sum_{j=1}^{n2} X[j,:] \cos(\pi j k /(n1)), \qquad k=0,\ldots,n1.\\ \mbox{DCTII:} \qquad X[k,:] & := 2 \sum_{j=0}^{n1} X[j,:] \cos(\pi(j+1/2)k/n), \qquad k=0,\ldots,n1.\\ \mbox{DCTIII:} \qquad X[k,:] & := X[0,:] + 2 \sum_{j=1}^{n1} X[j,:] \cos(\pi j(k+1/2)/n), \qquad k=0,\ldots,n1.\\ \mbox{DCTIV:} \qquad X[k,:] & := 2 \sum_{j=0}^{n1} X[j,:] \cos(\pi (j+1/2)(k+1/2)/n), \qquad k=0,\ldots,n1.\end{split}\]

cvxopt.fftw.
idct
(X[, type = 2])¶ Replaces the columns of a dense real matrix with the inverses of the discrete cosine transforms defined above.
The module also includes a discrete Ndimensional cosine transform. The input matrix is interpreted as an Ndimensional matrix stored in columnmajor order. The discrete Ndimensional cosine transform computes the corresponding onedimensional transform along each dimension. For example, the twodimensional transform applies a onedimensional transform to all the rows of the matrix, followed by a onedimensional transform to all the columns of the matrix.

cvxopt.fftw.
dctn
(X[, dims = X.size, type = 2])¶ Replaces a dense real matrix with its Ndimensional discrete cosine transform. The dimensions of the Ndimensional matrix are given by the Ntuple
dims
. The twodimensional transform is computed asdctn(X, X.size)
.

cvxopt.fftw.
idctn
(X[, dims = X.size, type = 2])¶ Replaces a dense real Ndimensional matrix with its inverse Ndimensional discrete cosine transform. The dimensions of the matrix are given by the tuple
dims
. The twodimensional inverse transform is computed asidctn(X, X.size)
.
Discrete Sine Transform¶

cvxopt.fftw.
dst
(X, dims[, type = 1])¶ Replaces the columns of a dense real matrix with their discrete sine transforms. The second argument, an integer between 1 and 4, denotes the type of transform (DSTI, DSTII, DSTIII, DSTIV). These transforms are defined as follows (for a matrix with \(n\) rows).
\[\begin{split}\mbox{DSTI:} \qquad X[k,:] & := 2 \sum_{j=0}^{n1} X[j,:] \sin(\pi(j+1)(k+1)/(n+1)), \qquad k=0,\ldots,n1.\\ \mbox{DSTII:} \qquad X[k,:] & := 2 \sum_{j=0}^{n1} X[j,:] \sin(\pi(j+1/2)(k+1)/n), \qquad k=0,\ldots,n1.\\ \mbox{DSTIII:} \qquad X[k,:] & := (1)^k X[n1,:] + 2 \sum_{j=0}^{n2} X[j,:] \sin(\pi(j+1)(k+1/2)/n), \qquad k=0,\ldots,n1. \\ \mbox{DSTIV:} \qquad X[k,:] & := 2 \sum_{j=0}^{n1} X[j,:] \sin(\pi (j+1/2)(k+1/2)/n), \qquad k=0,\ldots,n1.\end{split}\]

cvxopt.fftw.
idst
(X, dims[, type = 1])¶ Replaces the columns of a dense real matrix with the inverses of the discrete sine transforms defined above.
The module also includes a discrete Ndimensional sine transform. The input matrix is interpreted as an Ndimensional matrix stored in columnmajor order. The discrete Ndimensional sine transform computes the corresponding onedimensional transform along each dimension. For example, the twodimensional transform applies a onedimensional transform to all the rows of the matrix, followed by a onedimensional transform to all the columns of the matrix.

cvxopt.fftw.
dstn
(X[, dims = X.size, type = 2])¶ Replaces a dense real matrix with its Ndimensional discrete sine transform. The dimensions of the Ndimensional matrix are given by the Ntuple
dims
. The twodimensional transform is computed asdstn(X, X.size)
.

cvxopt.fftw.
idstn
(X[, dims = X.size, type = 2])¶ Replaces a dense real Ndimensional matrix with its inverse Ndimensional discrete sine transform. The dimensions of the matrix are given by the tuple
dims
. The twodimensional inverse transform is computed asidstn(X, X.size)
.