Package linalg
Class Decompose
java.lang.Object
linalg.Decompose
This class provided support for several decompositions of real or complex matrices.
Supported Decompositions:
-
-
-
-
-
-
-
-
-
// TODO: Add Hessenburg decomposition. i.e. A=PHP*
Supported Decompositions:
-
LU Decomposition
-
LUP Decomposition
-
LUPQ Decomposition
-
LDU Decomposition
-
QR Decomposition
-
Cholesky Decomposition
-
Complex Schur Decomposition
-
Real Schur Decomposition
-
Optional Real or Complex Schur Decomposition
// TODO: Add Hessenburg decomposition. i.e. A=PHP*
-
Method Summary
Modifier and TypeMethodDescriptionstatic Matrix[]
Computes the Cholesky decomposition of a Hermation, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose.static Matrix[]
Decomposes a square matrix A into a Lower triangular matrix L, a diagonal matrix D, and an upper triangular matrix U such that A = LDU.static Matrix[]
Factors a square matrix into a lower triangular matrix, L, and an upper triangular matrix, U, such that A = L*U.static Matrix[]
Factors a square matrix into a lower triangular matrix, L, and an upper triangular matrix, U using row swaps represented by a Matrix pivot matrix P such that PA = LU where P is the permutation matrix describing row swaps in A during partial pivoting.static Matrix[]
Factors a square matrix A into a lower triangular matrix, L, and an upper triangular matrix, U using row and column swaps represented by the permutation matrices P and Q such that PAQ = LU where P is the permutation matrix describing row swaps in A and Q is the permutation matrix describing column swaps in A.static Matrix[]
Computes the QR decomposition of a matrix A such that A=QR, Q is an orthogonal matrix and R is an upper triangular matrix.static Matrix[]
Computes the QR decomposition of a matrix A such that A=QR, Q is an orthogonal matrix and R is an upper triangular matrix.static Matrix[]
Computes the complex Schur decomposition of this matrix.static Matrix[]
Computes the real or complex Schur decomposition of this matrix.static Matrix[]
Computes the real Schur decomposition of this matrix.
-
Method Details
-
LU
Factors a square matrix into a lower triangular matrix, L, and an upper triangular matrix, U, such that A = L*U.
Note: This method does not use partial pivoting. To use partial pivoting see one of the following
-LUP(Matrix A)
-LUPQ(Matrix A)
Also seeLDU(Matrix A)
- Parameters:
A
- - Matrix to decompose.- Returns:
- An array of matrices representing LU decomposition using NO pivoting. The array contains in order [L, U]
-
LUP
Factors a square matrix into a lower triangular matrix, L, and an upper triangular matrix, U using row swaps represented by a Matrix pivot matrix P such that PA = LU where P is the permutation matrix describing row swaps in A during partial pivoting.
Also see
-LU(Matrix A)
-LUPQ(Matrix A)
-LDU(Matrix A)
- Parameters:
A
- - Matrix to decompose.- Returns:
- An array of matrices representing LU decomposition using partial pivoting. The array contains in order [L, U, P]
-
LUPQ
Factors a square matrix A into a lower triangular matrix, L, and an upper triangular matrix, U using row and column swaps represented by the permutation matrices P and Q such that PAQ = LU where P is the permutation matrix describing row swaps in A and Q is the permutation matrix describing column swaps in A.
Also see
-LU(Matrix A)
for LU decomposition with NO pivoting
-LUP(Matrix A)
for LU decomposition using partial pivoting.
-LDU(Matrix A)
- Parameters:
A
- - Matrix to decompose.- Returns:
- An array of matrices representing LU decomposition using full pivoting. The array contains in order [L, U, P, Q]
-
LDU
Decomposes a square matrix A into a Lower triangular matrix L, a diagonal matrix D, and an upper triangular matrix U such that A = LDU. -LU(Matrix A)
for LU decomposition with NO pivoting -LUP(Matrix A)
for LU decomposition using partial pivoting. -LUPQ(Matrix A)
for LU decomposition using full pivoting- Parameters:
A
- - Matrix to decompose.- Returns:
- Returns an array of matrices containing in order, L, D, and U.
-
QR
Computes the QR decomposition of a matrix A such that A=QR, Q is an orthogonal matrix and R is an upper triangular matrix.
If you would like to know the number of householder reflectors used in the QR decomposition, seeQR(Matrix A, boolean countHouseholder)
- Parameters:
A
- - a rectangular matrix with linearly independent columns.- Returns:
- An array of matrices of length 2 containing, in order, Q and R.
-
QR
Computes the QR decomposition of a matrix A such that A=QR, Q is an orthogonal matrix and R is an upper triangular matrix.
If you are not interested in knowing the number of householder reflectors used in the QR decomposition, seeQR(Matrix A)
- Parameters:
A
- - a rectangular matrix with linearly independent columns.countHouseholder
-- Returns:
- An array of matrices of length 2 or 3. The first and second matrix are always Q and R respectively. If countHouseholder flag is true, then a third 1-by-1 matrix containing the number of Householder reflectors used will also be returned.
-
cholesky
Computes the Cholesky decomposition of a Hermation, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose. This is similar to theLU decomposition
with the special requirement that L=U* where U* is the conjugate transpose of U.- Parameters:
A
- - A hermation, positive-definite matrix to be decomposed.- Returns:
- A matrix array containing in order a lower triangular matrix and its conjugate transpose.
-
schur
Computes the complex Schur decomposition of this matrix. That is decomposes a matrix A such that A = UTUH where U is a unitary matrix (i.e. UUH=I), and T is an upper triangular matrix which contains the corresponding eigenvalues of A along its diagonal.
Also seeschurReal(Matrix A)
which defaults to the real Schur decomposition andschur(Matrix A, boolean complex)
for optional real or complex Schur decomposition.- Parameters:
A
- - Matrix to decompose- Returns:
- An array of matrices of length three containing in order [U, T, UH].
-
schur
Computes the real or complex Schur decomposition of this matrix. That is decomposes a matrix A such that A = UTUH where U is a unitary matrix (i.e. UUH=I). In the complex Schur decomposition, T is an upper triangular matrix which contains the corresponding eigenvalues of A along its diagonal. In the real Schur decomposition, T is a block upper diagonal matrix containing real eigenvalues of A along the diagonal and representing any complex conjugate pair eigenvalues as a real 2-by-2 matrix. The eigenvalues of this 2-by-2 matrix are the complex conjugate eigenvalues of A.
Also seeschur(Matrix A)
which defaults to the complex Schur decomposition andschurReal(Matrix A)
which defaults to the real Schur decomposition.- Parameters:
A
- - Matrix to decomposecomplex
- - Flag to compute real or complex Schur decomposition. If true, the complex Schur decomposition will be computed. If false the real Schur decomposition will be computed.- Returns:
- An array of matrices of length two containing in order [U, T, UH].
-
schurReal
Computes the real Schur decomposition of this matrix. That is decomposes a matrix A such that A = UTUH where U is a unitary matrix (i.e. UHU=I) and T is a block upper diagonal matrix containing real eigenvalues of A along the diagonal and representing any complex conjugate pair eigenvalues as a real 2-by-2 matrix. The eigenvalues of this 2-by-2 matrix are the complex conjugate eigenvalues of A.
Also seeschur(Matrix A)
which defaults to the complex Schur decomposition andschur(Matrix A, boolean complex)
for optional real or complex Schur decomposition.- Parameters:
A
- - Matrix to decompose- Returns:
- An array of matrices of length two containing in order [U, T, UH].
-