@Test public void testEigen() { System.out.println("Eigen"); double[] v = new double[3]; for (int i = 0; i < v.length; i++) v[i] = 1.0; double eigenvalue = PowerIteration.eigen(new Matrix(A), v); assertEquals(eigenValues[0], eigenvalue, 1E-4); double ratio = Math.abs(eigenVectors[0][0]/v[0]); for (int i = 1; i < 3; i++) { assertEquals(ratio, Math.abs(eigenVectors[i][0]/v[i]), 1E-4); } for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[i].length; j++) A[i][j] = -A[i][j]; } for (int i = 0; i < v.length; i++) v[i] = 1.0; eigenvalue = PowerIteration.eigen(new Matrix(A), v, 0.22, 1E-4, 4); assertEquals(-eigenValues[0], eigenvalue, 1E-3); ratio = Math.abs(eigenVectors[0][0]/v[0]); for (int i = 1; i < 3; i++) { assertEquals(ratio, Math.abs(eigenVectors[i][0]/v[i]), 1E-3); } }
public static double eigen(DMatrix A, double[] v) { return eigen(A, v, 0.0f, Math.max(1.0E-6, A.nrows() * MathEx.EPSILON), Math.max(20, 2 * A.nrows())); }
PowerIteration { public static double eigen(DMatrix A, double[] v) { return eigen(A, v, 0.0f, Math.max(1.0E-6, A.nrows() * MathEx.EPSILON), Math.max(20, 2 * A.nrows())); } }
PowerIteration { public static double eigen(DMatrix A, double[] v) { return eigen(A, v, 0.0f, Math.max(1.0E-6, A.nrows() * MathEx.EPSILON), Math.max(20, 2 * A.nrows())); }  }
PowerIteration { public static double eigen(DMatrix A, double[] v) { return eigen(A, v, 0.0f, Math.max(1.0E-6, A.nrows() * MathEx.EPSILON), Math.max(20, 2 * A.nrows())); }  static double eigen(DMatrix A, double[] v); static double eigen(DMatrix A, double[] v, double p, double tol, int maxIter); }
PowerIteration { public static double eigen(DMatrix A, double[] v) { return eigen(A, v, 0.0f, Math.max(1.0E-6, A.nrows() * MathEx.EPSILON), Math.max(20, 2 * A.nrows())); }  static double eigen(DMatrix A, double[] v); static double eigen(DMatrix A, double[] v, double p, double tol, int maxIter);  }