ElementaryTransformations { private static void givens(DataBlockIterator vectors, int n) { DataBlock cur = vectors.getData(); for (int i = 1; i < n; ++i) { vectors.begin(); if (cur.get(i) != 0) { GivensRotation rotation = new GivensRotation(cur, i); while (vectors.next()) { rotation.transform(cur); } } } }  static void transform(IVectorTransformation transformation, DataBlockIterator vectors); static void rowHouseholder(SubMatrix m); static boolean givensTriangularize(final SubMatrix X); static boolean fastRowGivens(final SubMatrix X); static void rowHouseholder(final DataBlock row, final SubMatrix X); static boolean fastRowGivens(final DataBlock row, final SubMatrix X); static boolean fastGivensTriangularize(final SubMatrix X); static boolean householderTriangularize(final SubMatrix X); static void rowGivens(SubMatrix m); static void columnHouseholder(SubMatrix m); static boolean extendedGivensTriangularize(Matrix X, DataBlock W, Matrix L, DataBlock V); static double hypotenuse(double x, double y);  }
@Test public void testGivens() { Matrix M1 = M.clone(), M2 = M.clone(); ElementaryTransformations.fastGivensTriangularize(M1.subMatrix()); ElementaryTransformations.givensTriangularize(M2.subMatrix()); assertTrue(M1.minus(M2).nrm2() < 1e-9); Matrix S1 = S.clone(), S2 = S.clone(); ElementaryTransformations.fastGivensTriangularize(S1.subMatrix()); ElementaryTransformations.givensTriangularize(S2.subMatrix()); assertTrue(S1.minus(S2).nrm2() < 1e-9); Matrix T1 = T.clone(), T2 = T.clone(); ElementaryTransformations.fastGivensTriangularize(T1.subMatrix()); ElementaryTransformations.givensTriangularize(T2.subMatrix()); assertTrue(T1.minus(T2).nrm2() < 1e-9); }