Examples of Matrix3


Examples of jinngine.math.Matrix3

        new Matrix3().subtract(null);
    }

    @Test
    public void testAssignSub01() {
        final Matrix3 m = new Matrix3(
                -1., -2., -3.,
                -4., -5., -6.,
                -7., -8., -9.);
        final Matrix3 n = new Matrix3(
                10., 20., 30.,
                40., 50., 60.,
                70., 80., 90.);
        final Matrix3 r = m.assignSubtract(n);
        assertSame(r, m);
        assertNotSame(r, n);
        assertMatrixEquals(new double[]{
                    10., 20., 30.,
                    40., 50., 60.,
View Full Code Here

Examples of jinngine.math.Matrix3

                    -77., -88., -99.}, r);
    }

    @Test(expected = NullPointerException.class)
    public void testAssignSub02() {
        new Matrix3().assignSubtract(null);
    }
View Full Code Here

Examples of jinngine.math.Matrix3

        new Matrix3().assignSubtract(null);
    }

    @Test
    public void testIsNan() {
        final Matrix3 m = new Matrix3(
                -1., -2., -3.,
                -4., -5., -6.,
                -7., -8., -9.);
        assertFalse(m.isNaN());
        assertMatrixEquals(new double[]{
                    -1., -2., -3.,
                    -4., -5., -6.,
                    -7., -8., -9.}, m);

        assertTrue(new Matrix3(
                Double.NaN, -2., -3.,
                -4., -5., -6.,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., Double.NaN, -3.,
                -4., -5., -6.,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., Double.NaN,
                -4., -5., -6.,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                Double.NaN, -5., -6.,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                -4., Double.NaN, -6.,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                -4., -5., Double.NaN,
                -7., -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                -4., -5., -6.,
                Double.NaN, -8., -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                -4., -5., -6.,
                -8., Double.NaN, -9.).isNaN());
        assertTrue(new Matrix3(
                -1., -2., -3.,
                -4., -5., -6.,
                -8., -9., Double.NaN).isNaN());
    }
View Full Code Here

Examples of jinngine.math.Matrix3

                -8., -9., Double.NaN).isNaN());
    }

    @Test
    public void testDeterminan() {
        Matrix3 m = new Matrix3(
                1., 4., -7.,
                2., -5., 8.,
                3., 6., 9.);
        assertEquals(-258., m.determinant());
        assertMatrixEquals(new double[]{
                    1., 4., -7.,
                    2., -5., 8.,
                    3., 6., 9.}, m);
        assertEquals(1., Matrix3.identity().determinant());
        assertEquals(8., Matrix3.scaleMatrix(2.).determinant());
        assertEquals(0., new Matrix3().determinant());
    }
View Full Code Here

Examples of jinngine.math.Matrix3

        assertEquals(0., new Matrix3().determinant());
    }

    @Test
    public void testFNorm() {
        Matrix3 m = new Matrix3(
                1., 4., -7.,
                2., -5., 8.,
                3., 6., 9.);
        assertEquals(16.881943016134134, m.fnorm());
        assertMatrixEquals(new double[]{
                    1., 4., -7.,
                    2., -5., 8.,
                    3., 6., 9.}, m);
        assertEquals(1.7320508075688772, Matrix3.identity().fnorm());
        assertEquals(3.4641016151377544, Matrix3.scaleMatrix(2.).fnorm());
        assertEquals(0., new Matrix3().fnorm());
    }
View Full Code Here

Examples of jinngine.math.Matrix3

        assertEquals(0., new Matrix3().fnorm());
    }

    @Test
    public void testInverse01() {
        Matrix3 m = new Matrix3(
                1., 4., -7.,
                2., -5., 8.,
                3., 6., 9.);
        Matrix3 r = m.inverse();
        assertNotSame(r, m);
        assertMatrixEquals(new double[]{
                    1., 4., -7.,
                    2., -5., 8.,
                    3., 6., 9.}, m);
        Matrix3 i = r.assignMultiply(m);
        assertMatrixEquals(new double[]{
                    1., 0., 0.,
                    0., 1., 0.,
                    0., 0., 1.}, i, 1E-15);
    }
View Full Code Here

Examples of jinngine.math.Matrix3

                    0., 0., 1.}, i, 1E-15);
    }

    @Test
    public void testInverse02() {
        Matrix3 m = new Matrix3(
                1., 0., 0.,
                0., 1., 0.,
                0., 0., 1.);
        Matrix3 r = m.inverse();
        assertMatrixEquals(new double[]{
                    1., 0., 0.,
                    0., 1., 0.,
                    0., 0., 1.}, r, 1E-15);
    }
View Full Code Here

Examples of jinngine.math.Matrix3

                    0., 0., 1.}, r, 1E-15);
    }

    @Test
    public void testAssignInverse02() {
        Matrix3 m = new Matrix3(
                1., 4., -7.,
                2., -5., 8.,
                3., 6., 9.);
        Matrix3 r = m.assignInverse();
        assertSame(r, m);
        Matrix3 i = r.assignMultiply(new Matrix3(
                1., 4., -7.,
                2., -5., 8.,
                3., 6., 9.));
        assertMatrixEquals(new double[]{
                    1., 0., 0.,
View Full Code Here

Examples of jinngine.math.Matrix3

    }

    @Test
    public void testToArray() {

        final Matrix3 m = new Matrix3(
                1., 2., 3.,
                4., 5., 6.,
                7., 8., 9.);
        final double[] d = m.toArray();
        final double[] d2 = m.toArray();
        assertNotSame(d, d2);
        assertMatrixEquals(new double[]{
                    1., 2., 3.,
                    4., 5., 6.,
                    7., 8., 9.}, m);
View Full Code Here

Examples of jinngine.math.Matrix3

    @Test
    public void testToString() {
        assertEquals("[1.0, 2.0, 3.0]\n"
                + "[5.0, 6.0, 7.0]\n"
                + "[9.0, 10.0, 11.0]", new Matrix3(
                1., 2., 3.,
                5., 6., 7.,
                9., 10, 11).toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.