Package org.ejml.alg.dense.linsol.lu

Examples of org.ejml.alg.dense.linsol.lu.LinearSolverLu


            DenseMatrix64F expected = new DenseMatrix64F(N,N);
            DenseMatrix64F found = new DenseMatrix64F(N,N);

            // first compute inverse by LU
            LUDecompositionAlt alg = new LUDecompositionAlt();
            LinearSolverLu solver = new LinearSolverLu(alg);

            assertTrue( solver.setA(A));
            solver.invert(expected);

            // compute the result from the algorithm being tested
            UnrolledInverseFromMinor.inv(A,found);

            EjmlUnitTests.assertEquals(expected,found,1e-8);
View Full Code Here


    public void invert() {
        DenseMatrix64F A = new DenseMatrix64F(3,3, true, 0, 1, 2, -2, 4, 9, 0.5, 0, 5);
        DenseMatrix64F A_inv = RandomMatrices.createRandom(3,3,rand);

        LUDecompositionAlt decomp = new LUDecompositionAlt();
        LinearSolver solver = new LinearSolverLu(decomp);

        solver.setA(A);
        InvertUsingSolve.invert(solver,A,A_inv);

        DenseMatrix64F I = RandomMatrices.createRandom(3,3,rand);

        CommonOps.mult(A,A_inv,I);
View Full Code Here

     * Creates a solver for linear systems.  The A matrix will have dimensions (m,m).
     *
     * @return A new linear solver.
     */
    public static LinearSolver<DenseMatrix64F> linear( int matrixSize ) {
        return new LinearSolverLu(new LUDecompositionAlt());
    }
View Full Code Here

            } else {
                mat.set(0, 1.0/mat.get(0));
            }
        } else {
            LUDecompositionAlt alg = new LUDecompositionAlt();
            LinearSolverLu solver = new LinearSolverLu(alg);
            if( solver.setA(mat) ) {
                solver.invert(mat);
            } else {
                return false;
            }
        }
        return true;
View Full Code Here

            } else {
                result.set(01.0/mat.get(0));
            }
        } else {
            LUDecompositionAlt alg = new LUDecompositionAlt();
            LinearSolverLu solver = new LinearSolverLu(alg);

            if( !solver.setA(mat))
                return false;
            solver.invert(result);
        }
        return true;
    }
View Full Code Here

        DenseMatrix64F c = RandomMatrices.createRandom(2,5,rand);
        DenseMatrix64F c_exp = RandomMatrices.createRandom(2,5,rand);

        assertTrue(CommonOps.solve(a,b,c));
        LUDecompositionAlt alg = new LUDecompositionAlt();
        LinearSolverLu solver = new LinearSolverLu(alg);
        assertTrue(solver.setA(a));

        solver.solve(b,c_exp);

        EjmlUnitTests.assertEquals(c_exp,c,1e-8);
    }
View Full Code Here

    public void invert() {
        for( int i = 1; i <= 10; i++ ) {
            DenseMatrix64F a = RandomMatrices.createRandom(i,i,rand);

            LUDecompositionAlt lu = new LUDecompositionAlt();
            LinearSolverLu solver = new LinearSolverLu(lu);
            assertTrue(solver.setA(a));

            DenseMatrix64F a_inv = new DenseMatrix64F(i,i);
            DenseMatrix64F a_lu = new DenseMatrix64F(i,i);
            solver.invert(a_lu);

            CommonOps.invert(a,a_inv);
            CommonOps.invert(a);

            EjmlUnitTests.assertEquals(a,a_inv,1e-8);
View Full Code Here

//        System.out.println("invert GJ No Pivot     = "+ invertBenchmark(
//                new GaussJordanNoPivot(),mat,numTrials));
//        System.out.println("invert GJ              = "+ invertBenchmark(
//                new GaussJordan(mat.numRows),mat,numTrials));
        System.out.println("invert LU              = "+ invertBenchmark(
                new LinearSolverLu(new LUDecompositionAlt()),mat,numTrials));
        System.out.println("invert LU  NR          = "+ invertBenchmark(
                new LinearSolverLu(new LUDecompositionNR()),mat,numTrials));
        System.out.println("invert Ops             = "+
                invertOpsBenchmark(mat,numTrials));
//        System.out.println("unrolled               = "+
//                invertUnrolledBenchmark(mat,numTrials));
    }
View Full Code Here

    }

    private static void runAlgorithms( int numTrials )
    {
        System.out.println("solve LU A            = "+ solveBenchmark(
                new LinearSolverLu(new LUDecompositionAlt()),numTrials));
        System.out.println("solve LU B            = "+ solveBenchmark(
                new LinearSolverLuKJI(new LUDecompositionAlt()),numTrials));
        System.out.println("solve QR house        = "+ solveBenchmark(
                new LinearSolverQrHouse(),numTrials));
        System.out.println("solve QR house Col    = "+ solveBenchmark(
View Full Code Here

TOP

Related Classes of org.ejml.alg.dense.linsol.lu.LinearSolverLu

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.