Here we provide a list of structured matrices. This list is meant for internal purposes only. It exists because it is more convenient to read the rendered LaTeX code rather than the docstring source.
singd.structures.dense.DenseMatrix
Bases: StructuredMatrix
Unstructured dense matrix implemented in the StructuredMatrix
interface.
Store the dense matrix internally.
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Parameters:
-
mat
(Tensor
) –A symmetric matrix representing \(\mathbf{A}\).
Source code in singd/structures/dense.py
singd.structures.hierarchical.Hierarchical15_15Matrix
Bases: HierarchicalMatrixTemplate
Hierarchical matrix with K1=15
and K2=15
.
Note
See the template class HierarchicalMatrixTemplate
for a mathematical
description.
Store the structural components internally.
Parameters:
-
A
(Tensor
) –Dense symmetric matrix of shape
[K1, K1]
or smaller representing \(\mathbf{A}\). -
B
(Tensor
) –Dense rectangular matrix of shape
[K1, K - K1]
representing \(\mathbf{B}\). -
C
(Tensor
) –Vector of shape
[K - K1 - K2]
representing the diagonal of \(\mathbf{C}\). -
D
(Tensor
) –Dense rectangular matrix of shape
[K2, K - K1 - K2]
representing \(\mathbf{D}\). -
E
(Tensor
) –Dense symmetric matrix of shape
[K2, K2]
or smaller representing \(\mathbf{E}\).
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the shapes of the arguments are invalid.
Source code in singd/structures/hierarchical.py
DIAGONAL
singd.structures.diagonal.DiagonalMatrix
Bases: StructuredMatrix
Diagonal matrix implemented in the StructuredMatrix
interface.
A diagonal matrix is defined as
\( \begin{pmatrix} d_1 & 0 & \cdots & 0 \\ 0 & d_2 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 0 \\ 0 & \cdots & \ddots & d_K \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \quad \text{with} \quad \mathbf{d} := \begin{pmatrix} d_1 \\ d_2 \\ \vdots \\ d_K \\ \end{pmatrix} \in \mathbb{R}^K \)
Store the dense matrix internally.
Parameters:
-
mat_diag
(Tensor
) –A 1d tensor representing the matrix diagonal \(\mathbf{d}\).
Source code in singd/structures/diagonal.py
singd.structures.blockdiagonal.Block30DiagonalMatrix
Bases: BlockDiagonalMatrixTemplate
Block-diagonal matrix with blocks of size 30.
Note
See the template class BlockDiagonalMatrixTemplate
for a mathematical
description.
Store the matrix internally.
Parameters:
-
blocks
(Tensor
) –The diagonal blocks \(\{\mathbf{A}_n = \mathbf{A}_n^\top\}_{n = 1}^N\), supplied as a tensor of shape
[N, BLOCK_DIM, BLOCK_DIM]
. If there are no blocks, this argument has shape[0, BLOCK_DIM, BLOCK_DIM]
. -
last
(Tensor
) –The last block \(\mathbf{B} = \mathbf{B}^\top\) which contains the remaining matrix if
BLOCK_DIM
does not divide the matrix dimension. Has shape[last_dim, last_dim]
wherelast_dim
may be zero.
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the passed tensors have incorrect shape.
Source code in singd/structures/blockdiagonal.py
LOWER-TRIANGULAR
singd.structures.triltoeplitz.TrilToeplitzMatrix
Bases: StructuredMatrix
Class for lower-triangular Toeplitz-structured matrices.
A lower-triangular Toeplitz matrix is defined by:
\( \begin{pmatrix} d_1 & 0 & \cdots & 0 \\ d_2 & d_1 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 0 \\ d_K & \cdots & d_2 & d_1 \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \quad \text{with} \quad \mathbf{d} := \begin{pmatrix} d_1 \\ d_2 \\ \vdots \\ d_K \\ \end{pmatrix} \in \mathbb{R}^K\,. \)
Store the lower-triangular Toeplitz matrix internally.
Parameters:
-
lower_diags
(Tensor
) –The vector \(\mathbf{d}\) containing the constants of all lower diagonals, starting with the value on the main diagonal.
Source code in singd/structures/triltoeplitz.py
singd.structures.trilbottomrightdiag.TrilBottomRightDiagonalMatrix
Bases: RecursiveBottomLeftMatrixTemplate
Sparse lower-triangular matrix with bottom right diagonal.
This matrix is defined as follows:
\( \begin{pmatrix} a & \mathbf{0} \\ \mathbf{b} & \mathbf{C} \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \)
where
- \(a \in \mathbb{R}\) is a scalar, represented by a
DenseMatrix
- \(\mathbf{b} \in \mathbb{R}^{K-1}\) is a row vector, represented as PyTorch
Tensor
, and - \(\mathbf{C} \in \mathbb{R}^{(K-1)\times (K-1)}\) is a diagonal matrix represented
as a
DiagonalMatrix
.
Store the matrix internally.
Parameters:
-
A
(StructuredMatrix
) –Structured matrix representing the top left block \(\mathbf{A}\).
-
B
(Tensor
) –Rectangular tensor representing the bottom left block \(\mathbf{B}\).
-
C
(StructuredMatrix
) –Structured matrix representing the bottom right block \(\mathbf{C}\).
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the dimensions of the blocks do not match or the structured matrices are of wrong type.
Source code in singd/structures/recursive.py
singd.structures.triltopleftdiag.TrilTopLeftDiagonalMatrix
Bases: RecursiveBottomLeftMatrixTemplate
Sparse lower-triangular matrix with top left diagonal entries.
This matrix is defined as follows:
\( \begin{pmatrix} \mathbf{A} & \mathbf{0} \\ \mathbf{b} & c \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \)
where
- \(\mathbf{A} \in \mathbb{R}^{(K-1)\times (K-1)}\) is a diagonal matrix represented
as a
DiagonalMatrix
. - \(\mathbf{b} \in \mathbb{R}^{K-1}\) is a row vector, represented as PyTorch
Tensor
, and - \(c \in \mathbb{R}\) is a scalar, represented by a
DenseMatrix
.
Store the matrix internally.
Parameters:
-
A
(StructuredMatrix
) –Structured matrix representing the top left block \(\mathbf{A}\).
-
B
(Tensor
) –Rectangular tensor representing the bottom left block \(\mathbf{B}\).
-
C
(StructuredMatrix
) –Structured matrix representing the bottom right block \(\mathbf{C}\).
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the dimensions of the blocks do not match or the structured matrices are of wrong type.
Source code in singd/structures/recursive.py
UPPER-TRIANGULAR
singd.structures.triutoeplitz.TriuToeplitzMatrix
Bases: StructuredMatrix
Class for upper-triangular Toeplitz-structured matrices.
An upper-triangular Toeplitz matrix is defined by:
\( \begin{pmatrix} d_1 & d_2 & \cdots & d_K \\ 0 & d_1 & \ddots & \vdots \\ \vdots & \ddots & \ddots & d_2 \\ 0 & \cdots & 0 & d_1 \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \quad \text{with} \quad \mathbf{d} := \begin{pmatrix} d_1 \\ d_2 \\ \vdots \\ d_K \\ \end{pmatrix} \in \mathbb{R}^K\,. \)
Store the upper-triangular Toeplitz matrix internally.
Parameters:
-
upper_diags
(Tensor
) –A vector \(\mathbf{d}\) containing the constants of all upper diagonals, starting with the main diagonal.
Source code in singd/structures/triutoeplitz.py
singd.structures.triubottomrightdiag.TriuBottomRightDiagonalMatrix
Bases: RecursiveTopRightMatrixTemplate
Sparse upper-triangular matrix with bottom right diagonal entries.
This matrix is defined as follows:
\( \begin{pmatrix} a & \mathbf{b} \\ \mathbf{0} & \mathbf{C} \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \)
where
- \(a \in \mathbb{R}\) is a scalar, represented by a
DenseMatrix
- \(\mathbf{b} \in \mathbb{R}^{K-1}\) is a column vector, represented as PyTorch
Tensor
, and - \(\mathbf{C} \in \mathbb{R}^{(K-1)\times (K-1)}\) is a diagonal matrix represented
as a
DiagonalMatrix
.
Store the matrix internally.
Parameters:
-
A
(StructuredMatrix
) –Structured matrix representing the top left block \(\mathbf{A}\).
-
B
(Tensor
) –Rectangular tensor representing the top right block \(\mathbf{B}\).
-
C
(StructuredMatrix
) –Structured matrix representing the bottom right block \(\mathbf{C}\).
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the dimensions of the blocks do not match or the structured matrices are of wrong type.
Source code in singd/structures/recursive.py
singd.structures.triutopleftdiag.TriuTopLeftDiagonalMatrix
Bases: RecursiveTopRightMatrixTemplate
Sparse upper-triangular matrix with top left diagonal entries.
This matrix is defined as follows:
\( \begin{pmatrix} \mathbf{A} & \mathbf{b} \\ \mathbf{0} & c \\ \end{pmatrix} \in \mathbb{R}^{K \times K} \)
where
- \(\mathbf{A} \in \mathbb{R}^{(K-1)\times (K-1)}\) is a diagonal matrix represented
as a
DiagonalMatrix
. - \(\mathbf{b} \in \mathbb{R}^{K-1}\) is a column vector, represented as PyTorch
Tensor
, and - \(c \in \mathbb{R}\) is a scalar, represented by a
DenseMatrix
.
Store the matrix internally.
Parameters:
-
A
(StructuredMatrix
) –Structured matrix representing the top left block \(\mathbf{A}\).
-
B
(Tensor
) –Rectangular tensor representing the top right block \(\mathbf{B}\).
-
C
(StructuredMatrix
) –Structured matrix representing the bottom right block \(\mathbf{C}\).
Note
For performance reasons, symmetry is not checked internally and must be ensured by the caller.
Raises:
-
ValueError
–If the dimensions of the blocks do not match or the structured matrices are of wrong type.