Welcome to matrix_decomposition’s documentation!¶
Matrix decompositions¶
Several matrix decompositions are supported. They are available in matrix.decompositions:
LL decomposition¶
-
class
matrix.decompositions.
LL_Decomposition
(L, p=None)[source]¶ Bases:
matrix.decompositions.DecompositionBase
A matrix decomposition where \(LL^H\) is the decomposed (permuted) matrix.
L is a lower triangle matrix with ones on the diagonal. This decomposition is also called Cholesky decomposition.
Parameters: - L (numpy.ndarray or scipy.sparse.spmatrix) – The matrix L of the decomposition.
- p (numpy.ndarray) – The permutation vector used for the decomposition. This decomposition is of A[p[:, np.newaxis], p[np.newaxis, :]] where A is a matrix. optional, default: no permutation
-
L
¶ numpy.matrix
orscipy.sparse.spmatrix
– The matrix L of the decomposition.
-
P
¶ scipy.sparse.dok_matrix
– The permutation matrix. P @ A @ P.H is the matrix A permuted by the permutation of the decomposition
-
composed_matrix
¶ numpy.matrix
orscipy.sparse.spmatrix
– The composed matrix represented by this decomposition.
-
p
¶ numpy.ndarray
– The permutation vector. A[p[:, np.newaxis], p[np.newaxis, :]] is the matrix A permuted by the permutation of the decomposition
-
p_inverse
¶ numpy.ndarray
– The permutation vector that undos the permutation.
-
permute_matrix
(A)¶ Permute a matrix by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be permuted. Returns: The matrix A permuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
-
unpermute_matrix
(A)¶ Unpermute a matrix permuted by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be unpermuted. Returns: The matrix A unpermuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
LDL decomposition¶
-
class
matrix.decompositions.
LDL_Decomposition
(L, d, p=None)[source]¶ Bases:
matrix.decompositions.DecompositionBase
A matrix decomposition where \(LDL^H\) is the decomposed (permuted) matrix.
L is a lower triangle matrix with ones on the diagonal. D is a diagonal matrix. Only the diagonal values of D are stored.
Parameters: - L (numpy.ndarray or scipy.sparse.spmatrix) – The matrix L of the decomposition.
- d (numpy.ndarray) – The vector of the diagonal components of D of the decompositon.
- p (numpy.ndarray) – The permutation vector used for the decomposition. This decomposition is of A[p[:, np.newaxis], p[np.newaxis, :]] where A is a matrix. optional, default: no permutation
-
D
¶ scipy.sparse.dia_matrix
– The permutation matrix.
-
L
¶ numpy.matrix
orscipy.sparse.spmatrix
– The matrix L of the decomposition.
-
LD
¶ numpy.matrix
orscipy.sparse.spmatrix
– A matrix whose diagonal values are the diagonal values of D and whose off-diagonal values are those of L.
-
P
¶ scipy.sparse.dok_matrix
– The permutation matrix. P @ A @ P.H is the matrix A permuted by the permutation of the decomposition
-
composed_matrix
¶ numpy.matrix
orscipy.sparse.spmatrix
– The composed matrix represented by this decomposition.
-
d
¶ numpy.ndarray
– The diagonal vector of the matrix D of the decomposition.
-
p
¶ numpy.ndarray
– The permutation vector. A[p[:, np.newaxis], p[np.newaxis, :]] is the matrix A permuted by the permutation of the decomposition
-
p_inverse
¶ numpy.ndarray
– The permutation vector that undos the permutation.
-
permute_matrix
(A)¶ Permute a matrix by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be permuted. Returns: The matrix A permuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
-
unpermute_matrix
(A)¶ Unpermute a matrix permuted by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be unpermuted. Returns: The matrix A unpermuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
LDL decomposition compressed¶
-
class
matrix.decompositions.
LDL_DecompositionCompressed
(LD, p=None)[source]¶ Bases:
matrix.decompositions.DecompositionBase
A matrix decomposition where \(LDL^H\) is the decomposed (permuted) matrix.
L is a lower triangle matrix with ones on the diagonal. D is a diagonal matrix. L and D are stored in one matrix whose diagonal values are the diagonal values of D and whose off-diagonal values are those of L.
Parameters: - LD (numpy.ndarray or scipy.sparse.spmatrix) – A matrix whose diagonal values are the diagonal values of D and whose off-diagonal values are those of L.
- p (numpy.ndarray) – The permutation vector used for the decomposition. This decomposition is of A[p[:, np.newaxis], p[np.newaxis, :]] where A is a matrix. optional, default: no permutation
-
D
¶ scipy.sparse.dia_matrix
– The permutation matrix.
-
L
¶ numpy.matrix
orscipy.sparse.spmatrix
– The matrix L of the decomposition.
-
LD
¶ numpy.matrix
orscipy.sparse.spmatrix
– A matrix whose diagonal values are the diagonal values of D and whose off-diagonal values are those of L.
-
P
¶ scipy.sparse.dok_matrix
– The permutation matrix. P @ A @ P.H is the matrix A permuted by the permutation of the decomposition
-
composed_matrix
¶ numpy.matrix
orscipy.sparse.spmatrix
– The composed matrix represented by this decomposition.
-
d
¶ numpy.ndarray
– The diagonal vector of the matrix D of the decomposition.
-
p
¶ numpy.ndarray
– The permutation vector. A[p[:, np.newaxis], p[np.newaxis, :]] is the matrix A permuted by the permutation of the decomposition
-
p_inverse
¶ numpy.ndarray
– The permutation vector that undos the permutation.
-
permute_matrix
(A)¶ Permute a matrix by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be permuted. Returns: The matrix A permuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
-
unpermute_matrix
(A)¶ Unpermute a matrix permuted by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be unpermuted. Returns: The matrix A unpermuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
base decomposition¶
-
class
matrix.decompositions.
DecompositionBase
(p=None)[source]¶ Bases:
object
A matrix decomposition.
This class is a base class for matrix decompositions.
Parameters: p (numpy.ndarray) – The permutation vector used for the decomposition. This decomposition is of A[p[:, np.newaxis], p[np.newaxis, :]] where A is a matrix. optional, default: no permutation -
P
¶ scipy.sparse.dok_matrix
– The permutation matrix. P @ A @ P.H is the matrix A permuted by the permutation of the decomposition
-
composed_matrix
¶ numpy.matrix
orscipy.sparse.spmatrix
– The composed matrix represented by this decomposition.
-
p
¶ numpy.ndarray
– The permutation vector. A[p[:, np.newaxis], p[np.newaxis, :]] is the matrix A permuted by the permutation of the decomposition
-
p_inverse
¶ numpy.ndarray
– The permutation vector that undos the permutation.
-
permute_matrix
(A)[source]¶ Permute a matrix by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be permuted. Returns: The matrix A permuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
-
unpermute_matrix
(A)[source]¶ Unpermute a matrix permuted by the permutation of the decomposition.
Parameters: A (numpy.ndarray or scipy.sparse.spmatrix) – The matrix that should be unpermuted. Returns: The matrix A unpermuted by the permutation of the decomposition. Return type: numpy.ndarray or scipy.sparse.spmatrix
-