-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
The EigenDecompositionNonSymmetricimplementation returns a result without an exception.
Can the exception org.hipparchus.exception.MathIllegalArgumentException: matrix is singular also be avoided for the "Complex implementations" ComplexEigenDecomposition and OrderedComplexEigenDecomposition?
@Test
public void testEqualEigenValuesSingular() {
Array2DRowRealMatrix matrix =
new Array2DRowRealMatrix(new double[][] {{1, 0, 0}, {-2, 1, 0}, {0, 1, 1}});
EigenDecompositionNonSymmetric ed = new EigenDecompositionNonSymmetric(matrix);
for (int i = 0; i < 3; i++) {
System.out.println(ed.getEigenvector(i));
}
try {
ComplexEigenDecomposition complexEigenDecomposition = new ComplexEigenDecomposition(matrix);
for (int i = 0; i < 3; i++) {
System.out.println(complexEigenDecomposition.getEigenvector(i));
}
} catch (MathRuntimeException mre) {
mre.printStackTrace();
}
try {
ComplexEigenDecomposition ced = new OrderedComplexEigenDecomposition(matrix, //
ComplexEigenDecomposition.DEFAULT_EIGENVECTORS_EQUALITY, //
ComplexEigenDecomposition.DEFAULT_EPSILON, //
ComplexEigenDecomposition.DEFAULT_EPSILON_AV_VD_CHECK, //
(c1, c2) -> Double.compare(c2.norm(), c1.norm()));
for (int i = 0; i < 3; i++) {
System.out.println(ced.getEigenvector(i));
}
} catch (MathRuntimeException mre) {
mre.printStackTrace();
}
}See:
Metadata
Metadata
Assignees
Labels
No labels