Package org.matrix

Examples of org.matrix.Matrix.toPackedArray()


        Matrix myMatrix = new Matrix(2, 2);
        myMatrix.set(0, 0, 1.0);
        myMatrix.set(0, 1, 2.0);
        myMatrix.set(1, 0, 3.0);
        myMatrix.set(1, 1, 4.0);
        double []myArray = myMatrix.toPackedArray();
        assertEquals(4, myArray.length);
        assertEquals(myArray[0], 1.0);
        assertEquals(myArray[1], 2.0);
        assertEquals(myArray[2], 3.0);
        assertEquals(myArray[3], 4.0);
View Full Code Here


    }
    @Test
    public void columnMatrixToArray() {
        double []myinitMatrix = {1, 2, 3};
        Matrix myMatrix = Matrix.createColumnMatrix(myinitMatrix);
        double []myArrayFromMatrix = myMatrix.toPackedArray();
        assertEquals(3, myArrayFromMatrix.length);
        assertEquals(myinitMatrix[0], myArrayFromMatrix[0], EPSILON);
        assertEquals(myinitMatrix[1], myArrayFromMatrix[1], EPSILON);
        assertEquals(myinitMatrix[2], myArrayFromMatrix[2], EPSILON);
    }
View Full Code Here

    }
    @Test
    public void rowMatrixToArray() {
        double []myinitMatrix = {1, 2, 3};
        Matrix myMatrix = Matrix.createRowMatrix(myinitMatrix);
        double []myArrayFromMatrix = myMatrix.toPackedArray();
        assertEquals(3, myArrayFromMatrix.length);
        assertEquals(myinitMatrix[0], myArrayFromMatrix[0], EPSILON);
        assertEquals(myinitMatrix[1], myArrayFromMatrix[1], EPSILON);
        assertEquals(myinitMatrix[2], myArrayFromMatrix[2], EPSILON);
    }
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.