@@ -0,0 +1,1272 @@
+package hu.kazocsaba.math.matrix;%0A%0Aimport java.util.Iterator;%0Aimport java.util.Map.Entry;%0Aimport java.util.SortedMap;%0Aimport java.util.TreeMap;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0A%0A/**%0A *%0A * @author Kaz%C3%B3 Csaba%0A */%0Apublic class EigenTest %7B%0A%09@Test%0A%09public void testEig() %7B%0A%09%09Matrix3 m=MatrixFactory.createMatrix3(new double%5B%5D%5B%5D %7B%0A%09%09%09%7B0,1,-1%7D,%0A%09%09%09%7B1,1,0%7D,%0A%09%09%09%7B-1,0,1%7D%0A%09%09%7D);%0A%09%09EigenDecomposition eig = m.eig();%0A%09%09SortedMap%3CDouble,Vector%3E eigenvalues=new TreeMap%3CDouble, Vector%3E();%0A%09%09for (int i=0; i%3C3; i++)%0A%09%09%09eigenvalues.put(eig.getEigenvalue(i), eig.getEigenvector(i));%0A%09%09Iterator%3CEntry%3CDouble, Vector%3E%3E iterator = eigenvalues.entrySet().iterator();%0A%09%09%0A%09%09Entry%3CDouble, Vector%3E entry = iterator.next();%0A%09%09assertEquals(-1, entry.getKey(), 1e-8);%0A%09%09assertEquals(1, Math.abs(entry.getValue().normalized().dot(MatrixFactory.createVector(2, -1, 1).normalized())), 1e-8);%0A%09%09%0A%09%09entry = iterator.next();%0A%09%09assertEquals(1, entry.getKey(), 1e-8);%0A%09%09assertEquals(1, Math.abs(entry.getValue().normalized().dot(MatrixFactory.createVector(0, 1, 1).normalized())), 1e-8);%0A%09%09%0A%09%09entry = iterator.next();%0A%09%09assertEquals(2, entry.getKey(), 1e-8);%0A%09%09assertEquals(1, Math.abs(entry.getValue().normalized().dot(MatrixFactory.createVector(1, 1, -1).normalized())), 1e-8);%0A%09%7D%0A%7D%0A

Add test for eigen decomposition.