java.lang.Object
imagingbook.common.math.eigen.EigenDecompositionApache
- All Implemented Interfaces:
RealEigenDecomposition
An implementation of
RealEigenDecomposition
, which merely wraps an instance of EigenDecomposition
as
provided by the Apache Commons Math library. Note this works only for square matrices and symmetry and zero
tolerances cannot be specified, default values are always used. The Jama version (EigenDecompositionJama
)
generally appears to be more flexible and robust.- Version:
- 2022/11/24
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor, calculates the eigen decomposition of the specified matrix, which must be square but does not need to be symmetric. -
Method Summary
Modifier and TypeMethodDescriptiongetEigenvector
(int k) Returns the k-th eigenvector, i.e., the k-th column vector of the matrix returned byRealEigenDecomposition.getV()
.Returns the underlying Apache eigendecomposition instance, mainly for debugging.double
getRealEigenvalue
(int k) Returns the real part of the k-th eigenvaluedouble[]
Returns a vector holding the real parts of the eigenvaluesgetV()
Return the matrix of eigenvectors, which are its column vectors.boolean
Returns whether the calculated eigenvalues are complex or real.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface imagingbook.common.math.eigen.RealEigenDecomposition
getD
-
Constructor Details
-
EigenDecompositionApache
Constructor, calculates the eigen decomposition of the specified matrix, which must be square but does not need to be symmetric.- Parameters:
M
- the matrix to decompose
-
-
Method Details
-
hasComplexEigenvalues
Description copied from interface:RealEigenDecomposition
Returns whether the calculated eigenvalues are complex or real.- Specified by:
hasComplexEigenvalues
in interfaceRealEigenDecomposition
- Returns:
true
if any of the eigenvalues is complex,false
otherwise
-
getRealEigenvalue
Description copied from interface:RealEigenDecomposition
Returns the real part of the k-th eigenvalue- Specified by:
getRealEigenvalue
in interfaceRealEigenDecomposition
- Parameters:
k
- index of the eigenvalue @param k index of the eigenvector (0-based)- Returns:
- real part of the k-th eigenvalue
-
getRealEigenvalues
Description copied from interface:RealEigenDecomposition
Returns a vector holding the real parts of the eigenvalues- Specified by:
getRealEigenvalues
in interfaceRealEigenDecomposition
- Returns:
- real(diag(D))
-
getEigenvector
Description copied from interface:RealEigenDecomposition
Returns the k-th eigenvector, i.e., the k-th column vector of the matrix returned byRealEigenDecomposition.getV()
.- Specified by:
getEigenvector
in interfaceRealEigenDecomposition
- Parameters:
k
- index of the eigenvector (0-based)- Returns:
- the k-th eigenvector (instance of
RealVector
)
-
getV
Description copied from interface:RealEigenDecomposition
Return the matrix of eigenvectors, which are its column vectors.- Specified by:
getV
in interfaceRealEigenDecomposition
- Returns:
- the matrix of eigenvectors
-
getInternalDecomposition
Returns the underlying Apache eigendecomposition instance, mainly for debugging.- Returns:
- the Apache eigendecomposition instance
-