Package org.ejml.data

Examples of org.ejml.data.BlockMatrix64F


    @Test
    public void testInvert() {
        BlockCholeskyOuterSolver solver = new BlockCholeskyOuterSolver();

        for( int i = 1; i <= r*3; i++ ) {
            BlockMatrix64F A = createMatrixSPD(i);
            BlockMatrix64F A_inv = BlockMatrixOps.createRandom(i,i,-1,1,rand,r);

            assertTrue(solver.setA(A.copy()));

            solver.invert(A_inv);

            BlockMatrix64F B = new BlockMatrix64F(i,i,r);

            BlockMatrixOps.mult(A,A_inv,B);

            assertTrue(GenericMatrixOps.isIdentity(B,1e-8));
        }
View Full Code Here


    public void testPositiveSolveNull() {
        BlockCholeskyOuterSolver solver = new BlockCholeskyOuterSolver();

        for( int i = 1; i <= r*3; i++ ) {
            for( int j = 1; j <= r*3; j++ ) {
                BlockMatrix64F A = createMatrixSPD(i);
                BlockMatrix64F X = BlockMatrixOps.createRandom(i,j,-1,1,rand,r);
                BlockMatrix64F Y = new BlockMatrix64F(i,j,r);
                BlockMatrix64F X_found = new BlockMatrix64F(i,j,r);

                // compute the expected solution directly
                BlockMatrixOps.mult(A,X,Y);

                assertTrue(solver.setA(A.copy()));
View Full Code Here

        }
    }

    @Test
    public void modifiesA(){
        BlockMatrix64F A = createMatrixSPD(4);
        BlockMatrix64F A_orig = A.copy();

        BlockQrHouseHolderSolver solver = new BlockQrHouseHolderSolver();

        assertTrue(solver.setA(A));
View Full Code Here

        assertTrue(modified == solver.modifiesA());
    }

    @Test
    public void modifiesB(){
        BlockMatrix64F A = createMatrixSPD(4);

        BlockQrHouseHolderSolver solver = new BlockQrHouseHolderSolver();

        assertTrue(solver.setA(A));

        BlockMatrix64F B = BlockMatrixOps.createRandom(4,2,-1,1,rand,3);
        BlockMatrix64F B_orig = B.copy();
        BlockMatrix64F X = new BlockMatrix64F(A.numRows,B.numCols,3);

        solver.solve(B,X);

        boolean modified = !MatrixFeatures.isEquals(B_orig,B);
View Full Code Here

    public DenseMatrix64F getQ(DenseMatrix64F Q, boolean transposed) {
        if( Q == null ) {
            Q = new DenseMatrix64F(Ablock.numRows,Ablock.numCols);
        }

        BlockMatrix64F Qblock = new BlockMatrix64F();
        Qblock.numRows =  Q.numRows;
        Qblock.numCols =  Q.numCols;
        Qblock.blockLength = blockLength;
        Qblock.data = Q.data;
View Full Code Here

                                              int numRows , int numCols , int blockLength ,
                                              boolean compact) {
        int minLength = Math.min(numRows,numCols);
        if( compact ) {
            if( Q == null ) {
                Q = new BlockMatrix64F(numRows,minLength,blockLength);
                BlockMatrixOps.setIdentity(Q);
            } else {
                if( Q.numRows != numRows || Q.numCols != minLength ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension. Found "+Q.numRows+" "+Q.numCols);
                } else {
                    BlockMatrixOps.setIdentity(Q);
                }
            }
        } else {
            if( Q == null ) {
                Q = new BlockMatrix64F(numRows,numRows,blockLength);
                BlockMatrixOps.setIdentity(Q);
            } else {
                if( Q.numRows != numRows || Q.numCols != numRows ) {
                    throw new IllegalArgumentException("Unexpected matrix dimension. Found "+Q.numRows+" "+Q.numCols);
                } else {
View Full Code Here

    public BlockMatrix64F getR(BlockMatrix64F R, boolean compact) {
        int min = Math.min(dataA.numRows,dataA.numCols);

        if( R == null ) {
            if( compact ) {
                R = new BlockMatrix64F(min,dataA.numCols,blockLength);
            } else {
                R = new BlockMatrix64F(dataA.numRows,dataA.numCols,blockLength);
            }
        } else {
            if( compact ) {
                if( R.numCols != dataA.numCols || R.numRows != min ) {
                    throw new IllegalArgumentException("Unexpected dimension.");
View Full Code Here

    protected DenseMatrix64F zerosM = new DenseMatrix64F(1,1);

    @Override
    public BlockMatrix64F getT(BlockMatrix64F T) {
        if( T == null ) {
            T = new BlockMatrix64F(A.numRows,A.numCols,A.blockLength);
        } else {
            if( T.numRows != A.numRows || T.numCols != A.numCols )
                throw new IllegalArgumentException("T must have the same dimensions as the input matrix");

            CommonOps.fill(T, 0);
View Full Code Here

                Q = new DenseMatrix64F(Ablock.numRows,Ablock.numRows);
                CommonOps.setIdentity(Q);
            }
        }

        BlockMatrix64F Qblock = new BlockMatrix64F();
        Qblock.numRows =  Q.numRows;
        Qblock.numCols =  Q.numCols;
        Qblock.blockLength = blockLength;
        Qblock.data = Q.data;
View Full Code Here

        return Q;
    }

    @Override
    public DenseMatrix64F getR(DenseMatrix64F R, boolean compact) {
        BlockMatrix64F Rblock;

        Rblock = ((BlockMatrix64HouseholderQR)alg).getR(null,compact);

        if( R == null ) {
            R = new DenseMatrix64F(Rblock.numRows,Rblock.numCols);
View Full Code Here

TOP

Related Classes of org.ejml.data.BlockMatrix64F

Copyright © 2018 www.massapicom. 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.