Package org.ejml.data

Examples of org.ejml.data.BlockMatrix64F


        for( int i = 1; i <= r*3; i++ ) {
            for( int j = i; j <= r*3; j++ ) {
                for( int k = 1; k <= r*3; k++ ) {
//                    System.out.println("i = "+i+" j = "+j+" k = "+k);
                    BlockMatrix64F A = BlockMatrixOps.createRandom(j,i,-1,1,rand,r);
                    BlockMatrix64F X = BlockMatrixOps.createRandom(i,k,-1,1,rand,r);
                    BlockMatrix64F Y = new BlockMatrix64F(j,k,r);
                    BlockMatrix64F X_found = new BlockMatrix64F(i,k,r);

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

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


    public void testInvert() {
        int r = 3;
        BlockQrHouseHolderSolver solver = new BlockQrHouseHolderSolver();

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

            BlockMatrix64F A_orig = A.copy();
            BlockMatrix64F I = new BlockMatrix64F(i,i,r);

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

            solver.invert(A);

View Full Code Here

        }
    }

    @Test
    public void testQuality() {
        BlockMatrix64F A = BlockMatrixOps.convert(CommonOps.diag(4,3,2,1),3);
        BlockMatrix64F B = BlockMatrixOps.convert(CommonOps.diag(4,3,2,0.1),3);

        // see if a matrix with smaller singular value has a worse quality
        BlockQrHouseHolderSolver solver = new BlockQrHouseHolderSolver();
        assertTrue(solver.setA(A.copy()));
        double qualityA = solver.quality();

        assertTrue(solver.setA(B.copy()));
        double qualityB = solver.quality();

        assertTrue(qualityB<qualityA);
        assertEquals(qualityB*10.0,qualityA,1e-8);
    }
View Full Code Here

    /**
     * Checks to see if quality is scale invariant.
     */
    @Test
    public void testQuality_scale() {
        BlockMatrix64F A = BlockMatrixOps.convert(CommonOps.diag(4,3,2,1),3);
        BlockMatrix64F B = A.copy();
        CommonOps.scale(2,B);

        // see if a matrix with smaller singular value has a worse quality
        BlockQrHouseHolderSolver solver = new BlockQrHouseHolderSolver();
        assertTrue(solver.setA(A.copy()));
        double qualityA = solver.quality();

        assertTrue(solver.setA(B.copy()));
        double qualityB = solver.quality();

        assertEquals(qualityA,qualityB,1e-8);
    }
View Full Code Here

        assertEquals(qualityA,qualityB,1e-8);
    }

    @Test
    public void modifiesA(){
        BlockMatrix64F A = BlockMatrixOps.createRandom(4,4,-1,1,rand,3);
        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 = BlockMatrixOps.createRandom(4,4,-1,1,rand,3);

        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

        return ((BlockCholeskyOuterForm)alg).isLower();
    }

    @Override
    public DenseMatrix64F getT(DenseMatrix64F T) {
        BlockMatrix64F T_block = ((BlockCholeskyOuterForm)alg).getT(null);

        if( T == null ) {
            T = new DenseMatrix64F(T_block.numRows,T_block.numCols);
        }
View Full Code Here

    }

    @Override
    public void invert(BlockMatrix64F A_inv) {
        BlockMatrix64F T = chol.getT(null);
        if( A_inv.numRows != T.numRows || A_inv.numCols != T.numCols )
            throw new IllegalArgumentException("Unexpected number or rows and/or columns");


        if( temp == null || temp.length < blockLength*blockLength )
View Full Code Here

     * a matrix by Q<sup>T</sup> and applying Q to it.
     */
    public void applyQTran() {
        for( int i = 1; i <= 3*r; i++ ) {
            for( int j = 1; j <= 3*r; j++ ) {
                BlockMatrix64F A = BlockMatrixOps.createRandom(i,j,-1,1,rand,r);

                assertTrue(alg.decompose(A.copy()));

                BlockMatrix64F Q = alg.getQ(null,false);

                BlockMatrix64F B = BlockMatrixOps.createRandom(i,j,-1,1,rand,r);
                BlockMatrix64F expected = new BlockMatrix64F(i,j,r);

                BlockMatrixOps.multTransA(Q,B,expected);
                alg.applyQTran(B);

                assertTrue(MatrixFeatures.isIdentical(expected,B,1e-8));
View Full Code Here

     * a matrix by Q and applying Q to it.
     */
    public void applyQ() {
        for( int i = 1; i <= 3*r; i++ ) {
            for( int j = 1; j <= 3*r; j++ ) {
                BlockMatrix64F A = BlockMatrixOps.createRandom(i,j,-1,1,rand,r);

                assertTrue(alg.decompose(A.copy()));

                BlockMatrix64F Q = alg.getQ(null,false);

                BlockMatrix64F B = BlockMatrixOps.createRandom(i,j,-1,1,rand,r);
                BlockMatrix64F expected = new BlockMatrix64F(i,j,r);

                BlockMatrixOps.mult(Q,B,expected);
                alg.applyQ(B);

                assertTrue(MatrixFeatures.isIdentical(expected,B,1e-8));
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.