Example usage for org.apache.commons.math.linear LUDecomposition getDeterminant

List of usage examples for org.apache.commons.math.linear LUDecomposition getDeterminant

Introduction

In this page you can find the example usage for org.apache.commons.math.linear LUDecomposition getDeterminant.

Prototype

double getDeterminant();

Source Link

Document

Return the determinant of the matrix

Usage

From source file:com.opengamma.analytics.math.linearalgebra.LUDecompositionCommonsResult.java

/**
 * @param lu The result of the LU decomposition, not null. $\mathbf{L}$ cannot be singular.
 *///from  w  w  w  .  j a va2 s. c o m
public LUDecompositionCommonsResult(final LUDecomposition lu) {
    Validate.notNull(lu, "LU decomposition");
    Validate.notNull(lu.getL(), "Matrix is singular; could not perform LU decomposition");
    _determinant = lu.getDeterminant();
    _l = CommonsMathWrapper.unwrap(lu.getL());
    _p = CommonsMathWrapper.unwrap(lu.getP());
    _pivot = lu.getPivot();
    _solver = lu.getSolver();
    _u = CommonsMathWrapper.unwrap(lu.getU());
}

From source file:com.opengamma.analytics.math.matrix.CommonsMatrixAlgebra.java

/**
 * {@inheritDoc}/* w  w  w . j a v a 2s .c o m*/
 */
@Override
public double getDeterminant(final Matrix<?> m) {
    Validate.notNull(m, "m");
    if (m instanceof DoubleMatrix2D) {
        final RealMatrix temp = CommonsMathWrapper.wrap((DoubleMatrix2D) m);
        final LUDecomposition lud = new LUDecompositionImpl(temp);
        return lud.getDeterminant();
    }
    throw new IllegalArgumentException("Can only find determinant of DoubleMatrix2D; have " + m.getClass());
}