Examples of LUDecompositionImpl


Examples of org.apache.commons.math.linear.LUDecompositionImpl

    }

    /** test solve singularity errors */
    public void testSolveSingularityErrors() {
        DecompositionSolver solver =
            new LUDecompositionImpl(MatrixUtils.createRealMatrix(singular)).getSolver();
        RealMatrix b = MatrixUtils.createRealMatrix(new double[2][2]);
        try {
            solver.solve(b);
            fail("an exception should have been thrown");
        } catch (InvalidMatrixException ime) {
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

    }

    /** test solve */
    public void testSolve() {
        DecompositionSolver solver =
            new LUDecompositionImpl(MatrixUtils.createRealMatrix(testData)).getSolver();
        RealMatrix b = MatrixUtils.createRealMatrix(new double[][] {
                { 1, 0 }, { 2, -5 }, { 3, 1 }
        });
        RealMatrix xRef = MatrixUtils.createRealMatrix(new double[][] {
                { 19, -71 }, { -6, 22 }, { -2, 9 }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

        assertEquals0, getDeterminant(MatrixUtils.createRealMatrix(singular)), 1.0e-17);
        assertEquals0, getDeterminant(MatrixUtils.createRealMatrix(bigSingular)), 1.0e-10);
    }

    private double getDeterminant(RealMatrix m) {
        return new LUDecompositionImpl(m).getDeterminant();
    }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

     */
    @Override
    protected RealMatrix calculateBetaVariance() {
        int p = X.getColumnDimension();
        RealMatrix Raug = qr.getR().getSubMatrix(0, p - 1 , 0, p - 1);
        RealMatrix Rinv = new LUDecompositionImpl(Raug).getSolver().getInverse();
        return Rinv.multiply(Rinv.transpose());
    }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

     * <p>The inverse of the covariance matrix is lazily evaluated and cached.</p>
     * @return inverse of the covariance
     */
    protected RealMatrix getOmegaInverse() {
        if (OmegaInverse == null) {
            OmegaInverse = new LUDecompositionImpl(Omega).getSolver().getInverse();
        }
        return OmegaInverse;
    }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

    @Override
    protected RealVector calculateBeta() {
        RealMatrix OI = getOmegaInverse();
        RealMatrix XT = X.transpose();
        RealMatrix XTOIX = XT.multiply(OI).multiply(X);
        RealMatrix inverse = new LUDecompositionImpl(XTOIX).getSolver().getInverse();
        return inverse.multiply(XT).multiply(OI).operate(Y);
    }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

     */
    @Override
    protected RealMatrix calculateBetaVariance() {
        RealMatrix OI = getOmegaInverse();
        RealMatrix XTOIX = X.transpose().multiply(OI).multiply(X);
        return new LUDecompositionImpl(XTOIX).getSolver().getInverse();
    }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

        }

        try {
            // compute the covariances matrix
            RealMatrix inverse =
                new LUDecompositionImpl(MatrixUtils.createRealMatrix(jTj)).getSolver().getInverse();
            return inverse.getData();
        } catch (InvalidMatrixException ime) {
            throw new OptimizationException("unable to compute covariances: singular problem");
        }
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

            try {

                // solve the linearized least squares problem
                RealMatrix mA = new BlockRealMatrix(a);
                DecompositionSolver solver = useLU ?
                        new LUDecompositionImpl(mA).getSolver() :
                        new QRDecompositionImpl(mA).getSolver();
                final double[] dX = solver.solve(b);

                // update the estimated parameters
                for (int i = 0; i < cols; ++i) {
View Full Code Here

Examples of org.apache.commons.math.linear.LUDecompositionImpl

            }

            try {

                // solve the linearized least squares problem
                RealVector dX = new LUDecompositionImpl(a).getSolver().solve(b);

                // update the estimated parameters
                for (int i = 0; i < parameters.length; ++i) {
                    parameters[i].setEstimate(parameters[i].getEstimate() + dX.getEntry(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.