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 classNested classes/interfaces inherited from interface Eigenvalue
Eigenvalue.Eigenpair, Eigenvalue.Factory<N>, Eigenvalue.Generalisation, Eigenvalue.Generalised<N>, Eigenvalue.Spectral<N>Nested classes/interfaces inherited from interface MatrixDecomposition
MatrixDecomposition.Determinant<N>, MatrixDecomposition.EconomySize<N>, MatrixDecomposition.Factory<D>, MatrixDecomposition.Hermitian<N>, MatrixDecomposition.Ordered<N>, MatrixDecomposition.Pivoting<N>, MatrixDecomposition.RankRevealing<N>, MatrixDecomposition.Solver<N>, MatrixDecomposition.Updatable<N>, MatrixDecomposition.Values<N>Nested classes/interfaces inherited from interface Provider2D
Provider2D.Condition, Provider2D.Determinant<N>, Provider2D.Eigenpairs, Provider2D.Hermitian, Provider2D.Inverse<M>, Provider2D.Rank, Provider2D.Solution<M>, Provider2D.Trace<N>Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallbackNested classes/interfaces inherited from interface Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S,B>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R>, 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.private MatrixStore<Double> Fields inherited from interface Eigenvalue
C128, DESCENDING_NORM, H256, Q128, R064, R128Fields inherited from interface MatrixDecomposition
TYPICAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateDeterminant(Access2D<?> matrix) protected booleanbooleancomputeValuesOnly(Access2D.Collectable<Double, ? super TransformableRegion<Double>> matrix) booleandecompose(Access2D.Collectable<Double, ? super TransformableRegion<Double>> matrix) protected abstract booleandoDecompose(double[][] data, boolean valuesOnly) (package private) voiddoGeneral(double[][] data, boolean valuesOnly) (package private) voiddoSymmetric(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.voidgetEigenvalues(double[] realParts, Optional<double[]> imaginaryParts) (package private) double[]Return the imaginary parts of the eigenvalues(package private) double[]Return the real parts of the eigenvaluesgetTrace()A matrix' trace is the sum of the diagonal elements.getV()Return the eigenvector matrix(package private) booleanprotected MatrixStore<Double> makeD(double[] d, double[] e) voidreset()Delete computed results, and resets attributes to default valuesMethods inherited from class RawDecomposition
checkSymmetry, getColDim, getInternalData, getInternalStore, getRowDim, make, newRawStore, reset, wrapMethods inherited from class AbstractDecomposition
aggregator, applyPivotOrder, applyReverseOrder, collect, computed, copyColumn, copyRow, function, getDimensionalEpsilon, isAspectRatioNormal, isComputed, isSolvable, makeArray, makeDiagonal, makeEye, makeHouseholder, makeIdentity, makeRotation, makeRotation, makeZero, makeZero, scalar, wrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Eigenvalue
getEigenpair, getEigenpairs, getEigenvectors, isHermitian, isOrdered, reconstructMethods inherited from interface MatrixDecomposition
isComputedMethods inherited from interface MatrixDecomposition.Determinant
toDeterminantProviderMethods inherited from interface MatrixDecomposition.Hermitian
checkAndDecomposeMethods inherited from interface 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. -
myD
-
myTransposedV
private double[][] myTransposedVArray for internal storage of eigenvectors. -
myV
-
-
Constructor Details
-
RawEigenvalue
protected RawEigenvalue()
-
-
Method Details
-
calculateDeterminant
- Specified by:
calculateDeterminantin interfaceDeterminantTask<Double>
-
computeValuesOnly
public boolean computeValuesOnly(Access2D.Collectable<Double, ? super TransformableRegion<Double>> matrix) - Specified by:
computeValuesOnlyin 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:
decomposein 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:
getDin interfaceEigenvalue<Double>- Returns:
- D
-
getDeterminant
Description copied from interface:MatrixDecomposition.DeterminantA matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminantin interfaceMatrixDecomposition.Determinant<Double>- Specified by:
getDeterminantin interfaceProvider2D.Determinant<Double>- Returns:
- The matrix' determinant
-
getEigenvalues
Description copied from interface:EigenvalueEven 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 are ordered or not is indicated by the
Eigenvalue.isOrdered()method.- Specified by:
getEigenvaluesin interfaceEigenvalue<Double>- Returns:
- The eigenvalues.
-
getEigenvalues
- Specified by:
getEigenvaluesin 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
-
getTrace
Description copied from interface:EigenvalueA 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:
getTracein interfaceEigenvalue<Double>- Returns:
- The matrix' trace
-
getV
Return the eigenvector matrix- Specified by:
getVin interfaceEigenvalue<Double>- Returns:
- V
-
reset
public void reset()Description copied from interface:MatrixDecompositionDelete computed results, and resets attributes to default values- Specified by:
resetin interfaceMatrixDecomposition<Double>- Overrides:
resetin classAbstractDecomposition<Double, R064Store>
-
checkSolvability
protected boolean checkSolvability()- Overrides:
checkSolvabilityin classAbstractDecomposition<Double, R064Store>
-
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))
-
isValuesOnly
boolean isValuesOnly()
-