Examples of CRSByteMatrix


Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

public class CRSFactory extends CompressedFactory {

    @Override
    public ByteMatrix createMatrix() {

        return new CRSByteMatrix();
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    }

    @Override
    public ByteMatrix createMatrix(int rows, int columns) {

        return new CRSByteMatrix(rows, columns);
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    }

    @Override
    public ByteMatrix createMatrix(int rows, int columns, byte[] array) {

        return new CRSByteMatrix(rows, columns, array);
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    }

    @Override
    public ByteMatrix createMatrix(byte[][] array) {

        return new CRSByteMatrix(array);
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    }

    @Override
    public ByteMatrix createMatrix(ByteMatrix matrix) {

        return new CRSByteMatrix(matrix);
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    }

    @Override
    public ByteMatrix createMatrix(MatrixSource source) {

        return new CRSByteMatrix(source);
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    @Override
    public ByteMatrix createConstantMatrix(int rows, int columns, byte value) {

        if (value == 0) {
            return new CRSByteMatrix(rows, columns);
        }
        else {
            byte[][] columnValues = new byte[rows][columns];
            int[][] columnIndices = new int[rows][columns];
            int[] rowCardinalities = new int[rows];

            for (int i = 0; i < rows; i++) {
                rowCardinalities[i] = columns;
                for (int j = 0; j < columns; j++) {
                    columnValues[i][j] = value;
                    columnIndices[i][j] = j;
                }
            }

            return new CRSByteMatrix(rows, columns, columnValues, columnIndices, rowCardinalities);
        }
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    @Override
    public ByteMatrix createRandomMatrix(int rows, int columns, Random random) {

        int cardinality = (rows * columns) / DENSITY;

        ByteMatrix matrix = new CRSByteMatrix(rows, columns);
        for (; cardinality > 0; cardinality--) {
            final int i = random.nextInt(rows);
            final int j = random.nextInt(columns);
            matrix.set(i, j, (byte)random.nextInt());
        }

        return matrix;
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

    @Override
    public ByteMatrix createRandomSymmetricMatrix(int size, Random random) {

        int cardinality = (size * size) / DENSITY;

        ByteMatrix matrix = new CRSByteMatrix(size, size);
        for (int k = 0; k < cardinality / 2; k++) {
            final int i = random.nextInt(size);
            final int j = random.nextInt(size);
            final byte value = (byte)random.nextInt();

            matrix.set(i, j, value);
            matrix.set(j, i, value);
        }

        return matrix;
    }
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.matrix.sparse.CRSByteMatrix

            throw new IllegalArgumentException("Sides of blocks are incompatible!");
        }

        final int rows = a.rows() + c.rows();
        final int cols = a.columns() + b.columns();
        ByteMatrix matrix = new CRSByteMatrix(rows, cols);
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                if ((i < a.rows()) && (j < a.columns())) {
                    matrix.set(i, j, a.get(i, j));
                }
                if ((i < a.rows()) && (j > a.columns())) {
                    matrix.set(i, j, b.get(i, j));
                }
                if ((i > a.rows()) && (j < a.columns())) {
                    matrix.set(i, j, c.get(i, j));
                }
                if ((i > a.rows()) && (j > a.columns())) {
                    matrix.set(i, j, d.get(i, j));
                }
            }
        }

        return matrix;
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.