public Matrix chol() { try { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); Matrix l = new MTJDenseDoubleMatrix2D(chol.getL()); return l; } catch (Exception e) { throw new RuntimeException(e); } }
public Matrix chol() { try { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); Matrix l = new MTJDenseDoubleMatrix2D(chol.getL()); return l; } catch (Exception e) { throw new RuntimeException(e); } }
public Matrix invSPD() { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); return new MTJDenseDoubleMatrix2D(chol.solve(Matrices.identity(matrix.numRows()))); }
public Matrix invSPD() { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); return new MTJDenseDoubleMatrix2D(chol.solve(Matrices.identity(matrix.numRows()))); }
/** * Creates a Cholesky decomposition of the symmetric positive definite * matrix A. The result is a Cholesky factor R, such that * R.transpose().times( R ) equals the original symmetirc PD matrix A. * * @param A * Symmetric positive definite matrix A to decompose * @return * Cholesky decomposition of the given matrix A. */ public static CholeskyDecompositionMTJ create( final DenseMatrix A ) { DenseCholesky cholesky = DenseCholesky.factorize( A.getInternalMatrix() ); if( !cholesky.isSPD() ) { throw new IllegalArgumentException( "Matrix must be symmetric and positive definite!" ); } DenseMatrix R = DenseMatrixFactoryMTJ.INSTANCE.createWrapper( new no.uib.cipr.matrix.DenseMatrix( cholesky.getU() ) ); return new CholeskyDecompositionMTJ( R ); }
/** * Creates a Cholesky decomposition of the symmetric positive definite * matrix A. The result is a Cholesky factor R, such that * R.transpose().times( R ) equals the original symmetirc PD matrix A. * * @param A * Symmetric positive definite matrix A to decompose * @return * Cholesky decomposition of the given matrix A. */ public static CholeskyDecompositionMTJ create( final DenseMatrix A ) { DenseCholesky cholesky = DenseCholesky.factorize( A.getInternalMatrix() ); if( !cholesky.isSPD() ) { throw new IllegalArgumentException( "Matrix must be symmetric and positive definite!" ); } DenseMatrix R = DenseMatrixFactoryMTJ.INSTANCE.createWrapper( new no.uib.cipr.matrix.DenseMatrix( cholesky.getU() ) ); return new CholeskyDecompositionMTJ( R ); }
/** * Creates a Cholesky decomposition of the symmetric positive definite * matrix A. The result is a Cholesky factor R, such that * R.transpose().times( R ) equals the original symmetirc PD matrix A. * * @param A * Symmetric positive definite matrix A to decompose * @return * Cholesky decomposition of the given matrix A. */ public static CholeskyDecompositionMTJ create( final DenseMatrix A ) { DenseCholesky cholesky = DenseCholesky.factorize( A.getInternalMatrix() ); if( !cholesky.isSPD() ) { throw new IllegalArgumentException( "Matrix must be symmetric and positive definite!" ); } DenseMatrix R = DenseMatrixFactoryMTJ.INSTANCE.createWrapper( new no.uib.cipr.matrix.DenseMatrix( cholesky.getU() ) ); return new CholeskyDecompositionMTJ( R ); }