Package org.ejml.simple

Examples of org.ejml.simple.SimpleMatrix.mult()


        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

        EjmlUnitTests.assertEquals(octLower,L.getMatrix(),1e-5);
        EjmlUnitTests.assertEquals(octUpper,U.getMatrix(),1e-5);

        DenseMatrix64F A_found = P.mult(L).mult(U).getMatrix();
        assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
    }

    @Test
    public void testDecomposition2()
View Full Code Here


        SimpleMatrix L = SimpleMatrix.wrap(alg.getLower(null));
        SimpleMatrix U = SimpleMatrix.wrap(alg.getUpper(null));
        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

        DenseMatrix64F A_found = P.mult(L).mult(U).getMatrix();

        assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
    }

    @Test
View Full Code Here

        // try different offsets to make sure there are no implicit assumptions
        for( int offX = 0; offX <= r; offX += r) {
            for( int offY = 0; offY <= r; offY += r) {
                SimpleMatrix A = SimpleMatrix.random(2*r+2,2*r+2,-1,1,rand);
                A = A.mult(A.transpose());
                SimpleMatrix A_orig = A.copy();
                SimpleMatrix V = SimpleMatrix.random(r,A.numCols(),-1,1,rand);

                D1Submatrix64F Ab = insertIntoBlock(offY,offX,A,r);
                D1Submatrix64F Vb = insertIntoBlock(0,offX,V,r);
View Full Code Here

                    for( int j = 0; j <= i; j++ ) {
                        u.set(j,0.0);
                    }
                    u.set(i+1,1.0);

                    A = A.plus(u.mult(v.transpose())).plus(v.mult(u.transpose()));
                }
                // apply the reflector to that row
                TridiagonalBlockHelper.applyReflectorsToRow(r,Ab,Vb,row);

                // compare to manually computed solution
View Full Code Here

                u[i] /= nu;
            }

            SimpleMatrix Q_k = SimpleMatrix.wrap(SpecializedOps.createReflector(this.u,nu/tau));
            U = U.mult(Q_k);
            B = Q_k.mult(B);
        }
    }

    protected void computeV(int k) {
        u.reshape(n,1, false);
View Full Code Here

                        U.set(j,i,0);
                    }
                    U.set(i+1,i,1);
                }

                y = AA.plus(U.mult(V.transpose())).plus(V.mult(U.transpose())).mult(u);
            } else {
                y = AA.mult(u);
            }

            y = y.scale(-gamma);
View Full Code Here

        // K = PH'S^(-1)
        SimpleMatrix K = P.mult(H.transpose().mult(S.invert()));

        // x = x + Ky
        x = x.plus(K.mult(y));

        // P = (I-kH)P = P - KHP
        P = P.minus(K.mult(H).mult(P));
    }
View Full Code Here

        // x = x + Ky
        x = x.plus(K.mult(y));

        // P = (I-kH)P = P - KHP
        P = P.minus(K.mult(H).mult(P));
    }

    @Override
    public DenseMatrix64F getState() {
        return x.getMatrix();
View Full Code Here

            SimpleMatrix u = new SimpleMatrix(QR.numRows(),1);
            u.insertIntoThis(j,0,QR.extractMatrix(j, END,j,j+1));
            u.set(j,1.0);

            // A = (I - &gamma;*u*u<sup>T</sup>)*A<br>
            Q = Q.plus(-gammas[j],u.mult(u.transpose()).mult(Q));
        }

        return Q;
    }

View Full Code Here

        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivotMatrix(null));

        SimpleMatrix A_found = Q.mult(R);
        SimpleMatrix A = SimpleMatrix.wrap(orig);

        return A.mult(P).minus(A_found).normF()/A.normF();
    }

    private static void runAlgorithms( DenseMatrix64F mat  )
    {
        System.out.println("qr               = "+ evaluate(new QRDecompositionHouseholder(),mat));
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.