Package org.apache.commons.math.linear

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


    };

    /** test dimensions */
    @Test
    public void testDimensions() throws MathException {
        CholeskyDecomposition llt =
            new CholeskyDecompositionImpl(MatrixUtils.createRealMatrix(testData));
        assertEquals(testData.length, llt.getL().getRowDimension());
        assertEquals(testData.length, llt.getL().getColumnDimension());
        assertEquals(testData.length, llt.getLT().getRowDimension());
        assertEquals(testData.length, llt.getLT().getColumnDimension());
    }
View Full Code Here


    /** test A = LLT */
    @Test
    public void testAEqualLLT() throws MathException {
        RealMatrix matrix = MatrixUtils.createRealMatrix(testData);
        CholeskyDecomposition llt = new CholeskyDecompositionImpl(matrix);
        RealMatrix l  = llt.getL();
        RealMatrix lt = llt.getLT();
        double norm = l.multiply(lt).subtract(matrix).getNorm();
        assertEquals(0, norm, 1.0e-15);
    }
View Full Code Here

    /** test that LT is transpose of L */
    @Test
    public void testLTTransposed() throws MathException {
        RealMatrix matrix = MatrixUtils.createRealMatrix(testData);
        CholeskyDecomposition llt = new CholeskyDecompositionImpl(matrix);
        RealMatrix l  = llt.getL();
        RealMatrix lt = llt.getLT();
        double norm = l.subtract(lt.transpose()).getNorm();
        assertEquals(0, norm, 1.0e-15);
    }
View Full Code Here

                23000 },
                45600 },
                789, 100 },
                { 11, 12, 13, 14, 15 }
        });
       CholeskyDecomposition llt =
            new CholeskyDecompositionImpl(MatrixUtils.createRealMatrix(testData));

        // check values against known references
        RealMatrix l = llt.getL();
        assertEquals(0, l.subtract(lRef).getNorm(), 1.0e-13);
        RealMatrix lt = llt.getLT();
        assertEquals(0, lt.subtract(lRef.transpose()).getNorm(), 1.0e-13);

        // check the same cached instance is returned the second time
        assertTrue(l  == llt.getL());
        assertTrue(lt == llt.getLT());

    }
View Full Code Here

    };

    /** test dimensions */
    @Test
    public void testDimensions() throws MathException {
        CholeskyDecomposition llt =
            new CholeskyDecompositionImpl(MatrixUtils.createRealMatrix(testData));
        assertEquals(testData.length, llt.getL().getRowDimension());
        assertEquals(testData.length, llt.getL().getColumnDimension());
        assertEquals(testData.length, llt.getLT().getRowDimension());
        assertEquals(testData.length, llt.getLT().getColumnDimension());
    }
View Full Code Here

    /** test A = LLT */
    @Test
    public void testAEqualLLT() throws MathException {
        RealMatrix matrix = MatrixUtils.createRealMatrix(testData);
        CholeskyDecomposition llt = new CholeskyDecompositionImpl(matrix);
        RealMatrix l  = llt.getL();
        RealMatrix lt = llt.getLT();
        double norm = l.multiply(lt).subtract(matrix).getNorm();
        assertEquals(0, norm, 1.0e-15);
    }
View Full Code Here

    /** test that LT is transpose of L */
    @Test
    public void testLTTransposed() throws MathException {
        RealMatrix matrix = MatrixUtils.createRealMatrix(testData);
        CholeskyDecomposition llt = new CholeskyDecompositionImpl(matrix);
        RealMatrix l  = llt.getL();
        RealMatrix lt = llt.getLT();
        double norm = l.subtract(lt.transpose()).getNorm();
        assertEquals(0, norm, 1.0e-15);
    }
View Full Code Here

                23000 },
                45600 },
                789, 100 },
                { 11, 12, 13, 14, 15 }
        });
       CholeskyDecomposition llt =
            new CholeskyDecompositionImpl(MatrixUtils.createRealMatrix(testData));

        // check values against known references
        RealMatrix l = llt.getL();
        assertEquals(0, l.subtract(lRef).getNorm(), 1.0e-13);
        RealMatrix lt = llt.getLT();
        assertEquals(0, lt.subtract(lRef.transpose()).getNorm(), 1.0e-13);

        // check the same cached instance is returned the second time
        assertTrue(l  == llt.getL());
        assertTrue(lt == llt.getLT());
       
    }
View Full Code Here

   */
  @Override
  public CholeskyDecompositionResult evaluate(final DoubleMatrix2D x) {
    Validate.notNull(x);
    final RealMatrix temp = CommonsMathWrapper.wrap(x);
    CholeskyDecomposition cholesky;
    try {
      cholesky = new CholeskyDecompositionImpl(temp);
    } catch (Exception e) {
      throw new MathException(e.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math.linear.CholeskyDecomposition

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.