/** * Tests the {@link Matrix3#Matrix3(double, double, double, * double, double, double, double, double, double)} constructor. * This constructor is specific to the implementation class. */ @Test public void testConstructor() { initialize(-2078758443421995879L); final double[] elements = createRandomPositiveValues(SIZE * SIZE); final Matrix3 matrix = new Matrix3( elements[0], elements[1], elements[2], elements[3], elements[4], elements[5], elements[6], elements[7], elements[8]); validate(matrix); assertArrayEquals(elements, matrix.getElements(), STRICT); }
/** * Tests {@link MatrixSIS#convertAfter(int, Number, Number)} * using {@link java.awt.geom.AffineTransform} as a reference implementation. * * @since 0.6 */ @Test public void testConvertAfter() { testConvertAfter(new Matrix3()); }
/** * Tests {@link MatrixSIS#convertBefore(int, Number, Number)} * using {@link java.awt.geom.AffineTransform} as a reference implementation. * * @since 0.6 */ @Test public void testConvertBefore() { testConvertBefore(new Matrix3(), true); }
/** * Tests {@link MatrixSIS#translate(double[])} * using {@link java.awt.geom.AffineTransform} as a reference implementation. * * @since 1.0 */ @Test public void testTranslateVector() { testTranslateVector(new Matrix3()); } }
/** * Tests {@link MatrixSIS#multiply(double[])} * using {@link java.awt.geom.AffineTransform} as a reference implementation. * * @since 0.8 */ @Test public void testMultiplyVector() { testMultiplyVector(new Matrix3()); }
/** * Verifies our claim that {@code A.solve(B)} is equivalent to {@code A.inverse().multiply(B)}. * This claim is documented in {@link MatrixSIS#solve(Matrix)} javadoc. * * @throws NoninvertibleMatrixException should not happen. */ @Test public void testSolveEquivalence() throws NoninvertibleMatrixException { final Matrix3 A = new Matrix3( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 1); final Matrix3 B = new Matrix3( 0, 3, 0, 3, 0, 0, 0, 0, 1); // Verify the result of A.inverse().multiply(B) as a matter of principle. final double[] expected = A.inverse().multiply(B).getElements(); assertArrayEquals(new double[] { 0, 6, 0, 6, 0, 0, 0, 0, 1}, expected, TOLERANCE); // Now the actual test. assertEqualsElements(expected, SIZE, SIZE, A.solve(B), TOLERANCE); }