Package net.fec.openrq.util.linearalgebra.matrix

Examples of net.fec.openrq.util.linearalgebra.matrix.ByteMatrix.rows()


    public void testCreateDiagonalMatrix_3x3() {

        byte diagonal[] = new byte[] {1, 2, 3};
        ByteMatrix a = factory().createDiagonalMatrix(diagonal);

        assertEquals(3, a.rows());
        assertEquals(3, a.columns());

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (i == j) {
View Full Code Here


        int i = 1000000;
        int j = 2000000;

        ByteMatrix a = factory().createMatrix(i, j);

        assertEquals(i, a.rows());
        assertEquals(j, a.columns());

        for (int x = 0; x < i; x += 100000) {
            for (int y = 0; y < j; y += 500000) {
                a.set(x, y, aTimesB((byte)x, (byte)y));
View Full Code Here

        // Integer 65536 * 65536 overflows to 0
        assertEquals(0, i * j);

        ByteMatrix a = factory().createMatrix(i, j);

        assertEquals(i, a.rows());
        assertEquals(j, a.columns());

        a.set(0, 0, (byte)42);
        assertEquals(a.get(0, 0), 42);

View Full Code Here

        // Test overflow
        assertTrue(i * j < 0);

        ByteMatrix a = factory().createMatrix(i, j);

        assertEquals(i, a.rows());
        assertEquals(j, a.columns());

        for (int row = 0; row < 32; row++) {
            a.set(row, 1, (byte)3);
        }
View Full Code Here

    public void testIdentityMatrixSource() {

        for (Factory factory : FACTORIES) {
            ByteMatrix a = factory.createMatrix(new IdentityMatrixSource(5));

            assertEquals(5, a.rows());
            assertEquals(5, a.columns());

            for (int i = 0; i < a.rows(); i++) {
                for (int j = 0; j < a.columns(); j++) {
                    if (i == j) {
View Full Code Here

            ByteMatrix a = factory.createMatrix(new IdentityMatrixSource(5));

            assertEquals(5, a.rows());
            assertEquals(5, a.columns());

            for (int i = 0; i < a.rows(); i++) {
                for (int j = 0; j < a.columns(); j++) {
                    if (i == j) {
                        assertEquals(a.get(i, j), 1);
                    }
                    else {
View Full Code Here

        assertEquals(0, a.columns());
        assertEquals(5, b.columns());
        assertEquals(5, b.rows());
        assertEquals(5, c.rows());
        assertEquals(5, c.columns());
        assertEquals(5, d.rows());
        assertEquals(5, d.columns());

        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++)
            {
View Full Code Here

                                       {7, 0, 9}
        };

        ByteMatrix a = factory().createMatrix(array);

        assertEquals(3, a.rows());
        assertEquals(3, a.columns());

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                assertEquals(array[i][j], a.get(i, j));
View Full Code Here

    @Test
    public void testCreateConstantMatrix_3x3() {

        ByteMatrix a = factory().createConstantMatrix(3, 3, (byte)10);

        assertEquals(3, a.rows());
        assertEquals(3, a.columns());

        for (int i = 0; i < a.rows(); i++) {
            for (int j = 0; j < a.columns(); j++) {
                assertEquals(10, a.get(i, j));
View Full Code Here

        ByteMatrix a = factory().createConstantMatrix(3, 3, (byte)10);

        assertEquals(3, a.rows());
        assertEquals(3, a.columns());

        for (int i = 0; i < a.rows(); i++) {
            for (int j = 0; j < a.columns(); j++) {
                assertEquals(10, a.get(i, j));
            }
        }
    }
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.