Class RawEigenvalue
- All Implemented Interfaces:
Eigenvalue<Double>
,MatrixDecomposition<Double>
,MatrixDecomposition.Determinant<Double>
,MatrixDecomposition.Hermitian<Double>
,MatrixDecomposition.Ordered<Double>
,MatrixDecomposition.Values<Double>
,Provider2D
,Provider2D.Determinant<Double>
,Provider2D.Eigenpairs
,DeterminantTask<Double>
,MatrixTask<Double>
,Structure1D
,Structure2D
- Direct Known Subclasses:
RawEigenvalue.Dynamic
,RawEigenvalue.General
,RawEigenvalue.Symmetric
If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal and the eigenvector matrix V is orthogonal. I.e. A = V.times(D.times(V.transpose())) and V.times(V.transpose()) equals the identity matrix.
If A is not symmetric, then the eigenvalue matrix D is block diagonal with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The columns of V represent the eigenvectors in the sense that A*V = V*D, i.e. A.times(V) equals V.times(D). The matrix V may be badly conditioned, or even singular, so the validity of the equation A = V*D*inverse(V) depends upon V.cond().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
(package private) static final class
(package private) static final class
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
Eigenvalue.Eigenpair, Eigenvalue.Factory<N extends Comparable<N>>, Eigenvalue.Generalisation, Eigenvalue.Generalised<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
MatrixDecomposition.Determinant<N extends Comparable<N>>, MatrixDecomposition.EconomySize<N extends Comparable<N>>, MatrixDecomposition.Factory<D extends MatrixDecomposition<?>>, MatrixDecomposition.Hermitian<N extends Comparable<N>>, MatrixDecomposition.Ordered<N extends Comparable<N>>, MatrixDecomposition.Pivoting<N extends Comparable<N>>, MatrixDecomposition.RankRevealing<N extends Comparable<N>>, MatrixDecomposition.Solver<N extends Comparable<N>>, MatrixDecomposition.Values<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.matrix.Provider2D
Provider2D.Condition, Provider2D.Determinant<N extends Comparable<N>>, Provider2D.Eigenpairs, Provider2D.Hermitian, Provider2D.Inverse<M>, Provider2D.Rank, Provider2D.Solution<M>, Provider2D.Trace<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallback
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,
B extends Structure2D.Logical<S, B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R, C>, Structure2D.RowColumnMapper<R, C> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[]
Arrays for internal storage of eigenvalues.private double[]
Arrays for internal storage of eigenvalues.private MatrixStore
<Double> private double[][]
Array for internal storage of eigenvectors.Fields inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
C128, DESCENDING_NORM, H256, Q128, R064, R128
Fields inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
TYPICAL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateDeterminant
(Access2D<?> matrix) protected boolean
boolean
computeValuesOnly
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) boolean
decompose
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) protected abstract boolean
doDecompose
(double[][] data, boolean valuesOnly) (package private) void
doGeneral
(double[][] data, boolean valuesOnly) (package private) void
doSymmetric
(double[][] data, boolean valuesOnly) getD()
Return the block diagonal eigenvalue matrixA matrix' determinant is the product of its eigenvalues.Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers.void
getEigenvalues
(double[] realParts, Optional<double[]> imaginaryParts) (package private) double[]
Return the imaginary parts of the eigenvaluesgetInverse
(PhysicalStore<Double> preallocated) (package private) double[]
Return the real parts of the eigenvaluesgetSolution
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs, PhysicalStore<Double> preallocated) getTrace()
A matrix' trace is the sum of the diagonal elements.getV()
Return the eigenvector matrixinvert
(Access2D<?> original, PhysicalStore<Double> preallocated) protected MatrixStore
<Double> makeD
(double[] d, double[] e) void
reset()
Delete computed results, and resets attributes to default valuessolve
(MatrixStore<Double> rhs, DecompositionStore<Double> preallocated) solve
(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) Methods inherited from class org.ojalgo.matrix.decomposition.RawDecomposition
allocate, checkSymmetry, collect, function, getColDim, getInternalData, getInternalStore, getRowDim, make, makeDiagonal, newRawStore, reset, scalar, wrap, wrap
Methods inherited from class org.ojalgo.matrix.decomposition.AbstractDecomposition
computed, countColumns, countRows, getDimensionalEpsilon, isAspectRatioNormal, isComputed, isSolvable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
getEigenpair, getEigenpairs, getEigenvectors, isHermitian, isOrdered, reconstruct
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
isComputed
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Determinant
toDeterminantProvider
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Hermitian
checkAndDecompose
Methods inherited from interface org.ojalgo.structure.Structure2D
count, countColumns, countRows, firstInColumn, firstInRow, getColDim, getMaxDim, getMinDim, getRowDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
Field Details
-
d
private double[] dArrays for internal storage of eigenvalues. -
e
private double[] eArrays for internal storage of eigenvalues. -
myInverse
-
myTransposedV
private double[][] myTransposedVArray for internal storage of eigenvectors.
-
-
Constructor Details
-
RawEigenvalue
protected RawEigenvalue()
-
-
Method Details
-
calculateDeterminant
- Specified by:
calculateDeterminant
in interfaceDeterminantTask<Double>
-
computeValuesOnly
- Specified by:
computeValuesOnly
in interfaceMatrixDecomposition.Values<Double>
- Parameters:
matrix
- The matrix to decompose- Returns:
- The same as
MatrixDecomposition.Solver.compute(Collectable)
orMatrixDecomposition.decompose(Collectable)
if the instance does not implementMatrixDecomposition.Solver
.
-
decompose
- Specified by:
decompose
in interfaceMatrixDecomposition<Double>
- Parameters:
matrix
- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
getD
Return the block diagonal eigenvalue matrix- Specified by:
getD
in interfaceEigenvalue<Double>
- Returns:
- D
-
getDeterminant
Description copied from interface:MatrixDecomposition.Determinant
A matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminant
in interfaceMatrixDecomposition.Determinant<Double>
- Specified by:
getDeterminant
in interfaceProvider2D.Determinant<Double>
- Returns:
- The matrix' determinant
-
getEigenvalues
Description copied from interface:Eigenvalue
Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers. Typically they need to be expressed as complex numbers when [A] is not symmetric.
The values should be in the same order as the matrices "V" and "D", and if they is ordered or not is indicated by the
Eigenvalue.isOrdered()
method.- Specified by:
getEigenvalues
in interfaceEigenvalue<Double>
- Returns:
- The eigenvalues.
-
getEigenvalues
- Specified by:
getEigenvalues
in interfaceEigenvalue<Double>
- Parameters:
realParts
- An array that will receive the real parts of the eigenvaluesimaginaryParts
- An optional array that, if present, will receive the imaginary parts of the eigenvalues
-
getInverse
-
getInverse
-
getSolution
public MatrixStore<Double> getSolution(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs, PhysicalStore<Double> preallocated) -
getTrace
Description copied from interface:Eigenvalue
A matrix' trace is the sum of the diagonal elements. It is also the sum of the eigenvalues. This method should return the sum of the eigenvalues.- Specified by:
getTrace
in interfaceEigenvalue<Double>
- Returns:
- The matrix' trace
-
getV
Return the eigenvector matrix- Specified by:
getV
in interfaceEigenvalue<Double>
- Returns:
- V
-
invert
public MatrixStore<Double> invert(Access2D<?> original, PhysicalStore<Double> preallocated) throws RecoverableCondition - Throws:
RecoverableCondition
-
reset
public void reset()Description copied from interface:MatrixDecomposition
Delete computed results, and resets attributes to default values- Specified by:
reset
in interfaceMatrixDecomposition<Double>
- Overrides:
reset
in classAbstractDecomposition<Double>
-
solve
public MatrixStore<Double> solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) throws RecoverableCondition - Throws:
RecoverableCondition
-
solve
-
checkSolvability
protected boolean checkSolvability()- Overrides:
checkSolvability
in classAbstractDecomposition<Double>
-
doDecompose
protected abstract boolean doDecompose(double[][] data, boolean valuesOnly) -
makeD
-
doGeneral
void doGeneral(double[][] data, boolean valuesOnly) -
doSymmetric
void doSymmetric(double[][] data, boolean valuesOnly) -
getImaginaryParts
double[] getImaginaryParts()Return the imaginary parts of the eigenvalues- Returns:
- imag(diag(D))
-
getRealParts
double[] getRealParts()Return the real parts of the eigenvalues- Returns:
- real(diag(D))
-