Examples of BlockMatrix64F


Examples of org.ejml.data.BlockMatrix64F

        assertEquals(2346,max,1e-8);
    }

    @Test
    public void testFindMaxRow() {
        BlockMatrix64F A = BlockMatrixOps.createRandom(r*2+r-1,r*2-1,-1,1,rand,r);

        // make sure it ignores the first element
        A.set(1,1,100000);
        A.set(1,4,-2346);

        double max = BlockHouseHolder.findMaxRow(r,new D1Submatrix64F(A),1,2);

        assertEquals(2346,max,1e-8);
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

        }

        // now compute it using the block matrix stuff
        double temp[] = new double[ r ];

        BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
        BlockMatrix64F Wb = new BlockMatrix64F(Ab.numRows,Ab.numCols,r);

        D1Submatrix64F Ab_sub = new D1Submatrix64F(Ab);
        D1Submatrix64F Wb_sub = new D1Submatrix64F(Wb);

        BlockHouseHolder.computeW_Column(r,Ab_sub,Wb_sub,temp,betas,0);
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

            TridiagonalDecompositionHouseholderOrig decomp = new TridiagonalDecompositionHouseholderOrig();
            decomp.decompose(A.getMatrix());

            D1Submatrix64F Ab = insertIntoBlock(offX,offY,A,r);
            D1Submatrix64F V = new D1Submatrix64F(new BlockMatrix64F(r,offX+A.numCols(),r));
            V.col0 = offX;
            V.row1 = Ab.row1-Ab.row0;
            int gammaOffset = offX;
            double gammas[] = new double[gammaOffset+A.numCols()];
            TridiagonalBlockHelper.tridiagUpperRow(r,Ab,gammas,V);
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

                W = W.combine(i,0,z.transpose());
                Y = Y.combine(i,0,v);
            }

            // now compute it using the block matrix stuff
            BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
            BlockMatrix64F Wb = new BlockMatrix64F(Ab.numRows,Ab.numCols,r);

            D1Submatrix64F Ab_sub = new D1Submatrix64F(Ab);
            D1Submatrix64F Wb_sub = new D1Submatrix64F(Wb);

            TridiagonalBlockHelper.computeW_row(r,Ab_sub,Wb_sub,betas,0);
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

    public void initializeW() {
        initMatrices(r-1);

        double beta = 1.5;

        BlockMatrix64F Wb = BlockMatrixOps.convert(W.getMatrix(),r);
        BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);

        D1Submatrix64F Wb_sub = new D1Submatrix64F(Wb,0, W.numRows(), 0, r);
        D1Submatrix64F Yb_sub = new D1Submatrix64F(Ab,0, A.numRows(), 0, r);

        BlockHouseHolder.initializeW(r,Wb_sub,Yb_sub,r,beta);

        assertEquals(-beta,Wb.get(0,0),1e-8);

        for( int i = 1; i < Wb.numRows; i++ ) {
            assertEquals(-beta*Ab.get(i,0),Wb.get(i,0),1e-8);
        }
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

    private static D1Submatrix64F insertIntoBlock( int offRow , int offCol , SimpleMatrix A , int r )
    {
        DenseMatrix64F B = new DenseMatrix64F(offRow+A.numRows(),offCol+A.numCols());
        CommonOps.insert(A.getMatrix(),B,offRow,offCol);

        BlockMatrix64F C = BlockMatrixOps.convert(B,r);
        return new D1Submatrix64F(C,offRow,C.numRows,offCol,C.numCols);
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

    public void multA_u() {
        SimpleMatrix A = SimpleMatrix.random(2*r+2,2*r+2,-1,1,rand);
        // make a symmetric so that this mult will work
        A = A.transpose().mult(A);

        BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
        BlockMatrix64F V = new BlockMatrix64F(r,Ab.numCols,r);

        int row = 1;

        SimpleMatrix u = A.extractVector(true,row).transpose();
        for( int i = 0; i <= row; i++ ) {
            u.set(i,0);
        }
        u.set(row+1,1);

        SimpleMatrix v = A.mult(u).transpose();

        TridiagonalBlockHelper.multA_u(r,new D1Submatrix64F(Ab),
                new D1Submatrix64F(V),row);

        for( int i = row+1; i < A.numCols(); i++ ) {
            assertEquals(v.get(i),V.get(row,i),1e-8);
        }
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

        int M = r-1;
        initMatrices(M);

        double beta = 2.5;

        BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
        BlockMatrix64F Aw = BlockMatrixOps.convert(W.getMatrix(),r);

        // need to extract only the elements in W that are currently being used when
        // computing the expected Z
        W = W.extractMatrix(0,W.numRows(),0,M);
        SimpleMatrix T = SimpleMatrix.random(M,1,-1,1,rand);

        // -beta * (V + W*T)
        SimpleMatrix expected = V.plus(W.mult(T)).scale(-beta);

        BlockHouseHolder.computeZ(r,new D1Submatrix64F(Ab,0, A.numRows(), 0, r),new D1Submatrix64F(Aw,0, A.numRows(), 0, r),
                M,T.getMatrix().data,beta);

        for( int i = 0; i < A.numRows(); i++ ) {
            assertEquals(expected.get(i),Aw.get(i,M),1e-8);
        }
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

                y = AA.mult(u);
            }

            y = y.scale(-gamma);

            BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
            BlockMatrix64F Vb = BlockMatrixOps.convert(Vo.getMatrix(),r);

            TridiagonalBlockHelper.computeY(r,new D1Submatrix64F(Ab),new D1Submatrix64F(Vb),row,gamma);

            for( int i = row+1; i < A.numCols(); i++ ) {
                assertEquals(Vb.get(row,i),y.get(i),1e-8);
            }
        }
    }
View Full Code Here

Examples of org.ejml.data.BlockMatrix64F

        initMatrices(M);

        // Y'*V
        SimpleMatrix expected = Y.transpose().mult(V);

        BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
        double found[] = new double[ M ];

        BlockHouseHolder.computeY_t_V(r,new D1Submatrix64F(Ab,0, A.numRows(), 0, r),M,found);

        for( int i = 0; i < M; i++ ) {
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.