Hi
Is it possible to add an option so that eigenvalues are sorted in descending order of complex absolute value in OrderedComplexEigenDecomposition:
-
public static void main(String[] args) { double[][] d = {{-8.0, 12.0, 4.0}, {12.0, -20.0, 0.0}, {4.0, 0.0, -2.0}}; Array2DRowRealMatrix matrix = new Array2DRowRealMatrix(d); ComplexEigenDecomposition ed = new OrderedComplexEigenDecomposition(matrix); Complex[] realValues = ed.getEigenvalues(); for (int i = 0; i < realValues.length; i++) { System.out.print(realValues[i]); System.out.print(", "); } }
The next example gets an exception:
Exception in thread "main" java.lang.NullPointerException
at org.hipparchus.linear.OrderedComplexEigenDecomposition.<init>(OrderedComplexEigenDecomposition.java:56)
public static void main(String[] args) {
double[][] d = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
Array2DRowRealMatrix matrix = new Array2DRowRealMatrix(d);
ComplexEigenDecomposition ed = new OrderedComplexEigenDecomposition(matrix);
Complex[] realValues = ed.getEigenvalues();
for (int i = 0; i < realValues.length; i++) {
System.out.print(realValues[i]);
System.out.print(", ");
}
}