Class Eigen
-
Method Summary
Modifier and TypeMethodDescriptionstatic Complex128[]
get2x2EigenValues
(double a11, double a12, double a21, double a22) Computes the eigenvalues of a 2x2 matrix explicitly.static Complex128[]
get2x2EigenValues
(Complex128 a11, Complex128 a12, Complex128 a21, Complex128 a22) Computes the eigenvalues of a 2-by-2 complex matrix (assumed to be row major).static CVector
get2x2EigenValues
(CMatrix src) Computes the eigenvalues of a 2x2 matrix explicitly.static CVector
get2x2EigenValues
(Matrix src) Computes the eigenvalues of a 2x2 matrix explicitly.static CMatrix[]
getEigenPairs
(CMatrix src) Computes the eigenvalues and eigenvectors of a square real matrix.static CMatrix[]
getEigenPairs
(CMatrix src, long seed) Computes the eigenvalues and eigenvectors of a square complex matrix.static CMatrix[]
getEigenPairs
(Matrix src) Computes the eigenvalues and eigenvectors of a square complex matrix.static CMatrix[]
getEigenPairs
(Matrix src, long seed) Computes the eigenvalues and eigenvectors of a square real matrix.static CVector
getEigenValues
(CMatrix src) Computes the eigenvalues of a square complex dense matrix.static CVector
getEigenValues
(CMatrix src, long seed) Computes the eigenvalues of a square complex dense matrix.static CVector
getEigenValues
(CMatrix src, long seed, int maxIterationFactor) Computes the eigenvalues of a square complex dense matrix.static CVector
getEigenValues
(Matrix src) Computes the eigenvalues of a square real dense matrix.static CVector
getEigenValues
(Matrix src, long seed) Computes the eigenvalues of a square real dense matrix.static CVector
getEigenValues
(Matrix src, long seed, int maxIterationFactor) Computes the eigenvalues of a square real dense matrix.static CMatrix
getEigenVectors
(CMatrix src) Computes the eigenvectors of a square real dense matrix.static CMatrix
getEigenVectors
(CMatrix src, long seed) Computes the eigenvectors of a square real dense matrix.static CMatrix
getEigenVectors
(CMatrix src, long seed, int maxIterationFactor) Computes the eigenvectors of a square real dense matrix.static CMatrix
getEigenVectors
(Matrix src) Computes the eigenvectors of a square real dense matrix.static CMatrix
getEigenVectors
(Matrix src, long seed) Computes the eigenvectors of a square real dense matrix.static CMatrix
getEigenVectors
(Matrix src, long seed, int maxIterationFactor) Computes the eigenvectors of a square real dense matrix.static CMatrix
Computes the eigenvectors of an upper triangular matrix.static Matrix
Computes the eigenvectors of an upper triangular matrix.
-
Method Details
-
get2x2EigenValues
-
get2x2EigenValues
Computes the eigenvalues of a 2x2 matrix explicitly.- Parameters:
a11
- First entry in matrix (at index (0, 0)).a12
- Second entry in matrix (at index (0, 1)).a21
- Third entry in matrix (at index (1, 0)).a22
- Fourth entry in matrix (at index (1, 1)).- Returns:
- A complex array containing the eigenvalues of the 2x2
src
matrix.
-
get2x2EigenValues
-
get2x2EigenValues
public static Complex128[] get2x2EigenValues(Complex128 a11, Complex128 a12, Complex128 a21, Complex128 a22) Computes the eigenvalues of a 2-by-2 complex matrix (assumed to be row major).- Parameters:
a11
- The first entry in the 2-by-2 complex matrixa12
- The second entry in the 2-by-2 complex matrixa21
- The third entry in the 2-by-2 complex matrixa22
- The fourth entry in the 2-by-2 complex matrix- Returns:
- An array containing the eigenvalues of the specified 2-by-2 complex matrix. Eigenvalues will be repeated per their multiplicity.
-
getEigenValues
Computes the eigenvalues of a square real dense matrix. For reproducibility seegetEigenValues(Matrix, long)
. If the algorithm fails to converge within the default maximum number of iterations,getEigenValues(Matrix, long, int)
can be used to specify a larger number of iterations to attempt.- Parameters:
src
- The matrix to compute the eigenvalues of.- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenValues
Computes the eigenvalues of a square real dense matrix. If the algorithm fails to converge within the default maximum number of iterations,getEigenValues(Matrix, long, int)
can be used to specify a larger number of iterations to attempt.- Parameters:
src
- The matrix to compute the eigenvalues of.seed
- Seed for random shifts used in computing the eigenvalues.- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenValues
Computes the eigenvalues of a square real dense matrix.- Parameters:
src
- The matrix to compute the eigenvalues of.seed
- Seed for random shifts used in computing the eigenvalues.maxIterationFactor
- maximum iteration factor for use in computing the total maximum number of iterations to run theQR
algorithm for during eigenvalue computation. The maximum number of iterations will be computed as:maxIteration = maxIterationFactor * src.numRows;
- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenValues
Computes the eigenvalues of a square complex dense matrix. For reproducibility seegetEigenValues(CMatrix, long)
.- Parameters:
src
- The matrix to compute the eigenvalues of.- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenValues
Computes the eigenvalues of a square complex dense matrix.- Parameters:
src
- The matrix to compute the eigenvalues of.seed
- Seed for random shifts used in computing the eigenvalues. This allows for reproducibility despite randomness in the eigenvalue computation algorithm.- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenValues
Computes the eigenvalues of a square complex dense matrix.- Parameters:
src
- The matrix to compute the eigenvalues of.seed
- Seed for random shifts used in computing the eigenvalues.maxIterationFactor
- maximum iteration factor for use in computing the total maximum number of iterations to run theQR
algorithm for during eigenvalue computation. The maximum number of iterations will be computed as:maxIteration = maxIterationFactor * src.numRows;
- Returns:
- The eigenvalues of the
src
matrix. - See Also:
-
getEigenVectors
-
getEigenVectors
Computes the eigenvectors of a square real dense matrix. This method accepts a seed for the random number generator involved in the algorithm for computing the eigenvalues. This allows for reproducibility between calls.- Parameters:
src
- The matrix to compute the eigenvectors of.seed
- Seed for random shifts used in the algorithm to compute the eigenvalues of.- Returns:
- A matrix containing the eigenvectors of
src
as its columns. - See Also:
-
getEigenVectors
Computes the eigenvectors of a square real dense matrix. This method accepts a seed for the random number generator involved in the algorithm for computing the eigenvalues. This allows for reproducibility between calls.- Parameters:
src
- The matrix to compute the eigenvectors of.seed
- Seed for random shifts used in the algorithm to compute the eigenvalues of.maxIterationFactor
- maximum iteration factor for use in computing the total maximum number of iterations to run theQR
algorithm for during eigenvalue computation. The maximum number of iterations will be computed as:maxIteration = maxIterationFactor * src.numRows;
- Returns:
- A matrix containing the eigenvectors of
src
as its columns. - See Also:
-
getEigenVectors
-
getEigenVectors
Computes the eigenvectors of a square real dense matrix. This method accepts a seed for the random number generator involved in the algorithm for computing the eigenvalues. This allows for reproducibility between calls.- Parameters:
src
- The matrix to compute the eigenvectors of.seed
- Seed for random shifts used in the algorithm to compute the eigenvalues of.- Returns:
- A matrix containing the eigenvectors of
src
as its columns. - See Also:
-
getEigenVectors
Computes the eigenvectors of a square real dense matrix. This method accepts a seed for the random number generator involved in the algorithm for computing the eigenvalues. This allows for reproducibility between calls.- Parameters:
src
- The matrix to compute the eigenvectors of.seed
- Seed for random shifts used in the algorithm to compute the eigenvalues of.maxIterationFactor
- maximum iteration factor for use in computing the total maximum number of iterations to run theQR
algorithm for during eigenvalue computation. The maximum number of iterations will be computed as:maxIteration = maxIterationFactor * src.numRows;
- Returns:
- A matrix containing the eigenvectors of
src
as its columns. - See Also:
-
getEigenVectorsTriu
-
getEigenVectorsTriu
-
getEigenPairs
Computes the eigenvalues and eigenvectors of a square complex matrix.
This method calculates the eigenvalues and eigenvectors of the given complex matrix
src
. The eigenvalues are returned as a single-row matrix, while the eigenvectors are returned as a matrix where each column corresponds to an eigenvector of the input matrix.Random number generation is used internally during the computation to apply random shifts, which enhance numerical stability and improve convergence. Because of this, repeated calls to this method with the same matrix may produce slightly different results.
If reproducible results are required (e.g., for testing purposes), use the overloaded method
getEigenPairs(CMatrix, long)
that accepts a seed for the random number generator.- Parameters:
src
- The input matrix for which to compute the eigenvalues and eigenvectors. This matrix must be square (src.numRows == src.numCols
).- Returns:
- An array containing two matrices:
- The first matrix is a 1-by-
src.numCols
matrix containing the eigenvalues ofsrc
. - The second matrix is an
src.numRows
-by-src.numCols
matrix, where each column is an eigenvector corresponding to an eigenvalue in the first matrix.
- The first matrix is a 1-by-
- Throws:
IllegalArgumentException
- if the input matrixsrc
is not square (e.g.src.numRows != src.numCols
).- See Also:
-
getEigenPairs
Computes the eigenvalues and eigenvectors of a square real matrix.
This method calculates the eigenvalues and eigenvectors of the given real matrix
src
. The eigenvalues are collected and returned as a single-row matrix, while the eigenvectors are collected as the columns of matrix.The computation uses a random shift algorithm to enhance numerical stability and improve convergence. By providing a
seed
, the random shifts can be made deterministic, ensuring reproducible results for the same input matrix. For most applications, specifying a seed is optional and generally not required.- Parameters:
src
- The input matrix for which to compute the eigenvalues and eigenvectors. This matrix must be square (src.numRows == src.numCols
).seed
- A seed value for random shifts used in the algorithm. Providing a seed ensures that the results are reproducible when the same matrix is used as input. If reproducibility is not a concern, this value can be omitted or set to any arbitrary number.- Returns:
- An array containing two matrices:
- The first matrix is a 1-by-
src.numCols
matrix containing the eigenvalues ofsrc
. - The second matrix is an
src.numRows
-by-src.numCols
matrix, where each column is an eigenvector corresponding to an eigenvalue in the first matrix.
- The first matrix is a 1-by-
- Throws:
IllegalArgumentException
- if the input matrixsrc
is not square (e.g.src.numRows != src.numCols
).- See Also:
-
getEigenPairs
Computes the eigenvalues and eigenvectors of a square real matrix.
This method calculates the eigenvalues and eigenvectors of the given real matrix
src
. The eigenvalues are returned as a single-row matrix, while the eigenvectors are returned as a matrix where each column corresponds to an eigenvector of the input matrix.Random number generation is used internally during the computation to apply random shifts, which enhance numerical stability and improve convergence. Because of this, repeated calls to this method with the same matrix may produce slightly different results.
If reproducible results are required (e.g., for testing purposes), use the overloaded method
getEigenPairs(CMatrix, long)
that accepts a seed for the random number generator.- Parameters:
src
- The input matrix for which to compute the eigenvalues and eigenvectors. This matrix must be square (src.numRows == src.numCols
).- Returns:
- An array containing two matrices:
- The first matrix is a 1-by-
src.numCols
matrix containing the eigenvalues ofsrc
. - The second matrix is an
src.numRows
-by-src.numCols
matrix, where each column is an eigenvector corresponding to an eigenvalue in the first matrix.
- The first matrix is a 1-by-
- Throws:
IllegalArgumentException
- if the input matrixsrc
is not square (e.g.src.numRows != src.numCols
).- See Also:
-
getEigenPairs
Computes the eigenvalues and eigenvectors of a square complex matrix.
This method calculates the eigenvalues and eigenvectors of the given complex matrix
src
. The eigenvalues are collected and returned as a single-row matrix, while the eigenvectors are collected as the columns of matrix.The computation uses a random shift algorithm to enhance numerical stability and improve convergence. By providing a
seed
, the random shifts can be made deterministic, ensuring reproducible results for the same input matrix. For most applications, specifying a seed is optional and generally not required.- Parameters:
src
- The input matrix for which to compute the eigenvalues and eigenvectors. This matrix must be square (src.numRows == src.numCols
).seed
- A seed value for random shifts used in the algorithm. Providing a seed ensures that the results are reproducible when the same matrix is used as input. If reproducibility is not a concern, this value can be omitted or set to any arbitrary number.- Returns:
- An array containing two matrices:
- The first matrix is a 1-by-
src.numCols
matrix containing the eigenvalues ofsrc
. - The second matrix is an
src.numRows
-by-src.numCols
matrix, where each column is an eigenvector corresponding to an eigenvalue in the first matrix.
- The first matrix is a 1-by-
- Throws:
IllegalArgumentException
- if the input matrixsrc
is not square (e.g.src.numRows != src.numCols
).- See Also:
-