use of org.apache.commons.math3.linear.CholeskyDecomposition in project incubator-systemml by apache.
the class LibCommonsMath method computeCholesky.
/**
* Function to compute Cholesky decomposition of the given input matrix.
* The input must be a real symmetric positive-definite matrix.
*
* @param in commons-math3 Array2DRowRealMatrix
* @return matrix block
*/
private static MatrixBlock computeCholesky(Array2DRowRealMatrix in) {
if (!in.isSquare())
throw new DMLRuntimeException("Input to cholesky() must be square matrix -- given: a " + in.getRowDimension() + "x" + in.getColumnDimension() + " matrix.");
CholeskyDecomposition cholesky = new CholeskyDecomposition(in, 1e-14, CholeskyDecomposition.DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD);
RealMatrix rmL = cholesky.getL();
return DataConverter.convertToMatrixBlock(rmL.getData());
}
Aggregations