}
}
}
public void testMatricesValues() {
BiDiagonalTransformer transformer =
new BiDiagonalTransformer(MatrixUtils.createRealMatrix(testSquare));
final double s17 = Math.sqrt(17.0);
RealMatrix uRef = MatrixUtils.createRealMatrix(new double[][] {
{ -8 / (5 * s17), 19 / (5 * s17) },
{ -19 / (5 * s17), -8 / (5 * s17) }
});
RealMatrix bRef = MatrixUtils.createRealMatrix(new double[][] {
{ -3 * s17 / 5, 32 * s17 / 85 },
{ 0.0, -5 * s17 / 17 }
});
RealMatrix vRef = MatrixUtils.createRealMatrix(new double[][] {
{ 1.0, 0.0 },
{ 0.0, -1.0 }
});
// check values against known references
RealMatrix u = transformer.getU();
assertEquals(0, u.subtract(uRef).getNorm(), 1.0e-14);
RealMatrix b = transformer.getB();
assertEquals(0, b.subtract(bRef).getNorm(), 1.0e-14);
RealMatrix v = transformer.getV();
assertEquals(0, v.subtract(vRef).getNorm(), 1.0e-14);
// check the same cached instance is returned the second time
assertTrue(u == transformer.getU());
assertTrue(b == transformer.getB());
assertTrue(v == transformer.getV());
}