Example usage for org.apache.commons.math.linear SingularValueDecomposition getConditionNumber

List of usage examples for org.apache.commons.math.linear SingularValueDecomposition getConditionNumber

Introduction

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

Prototype

double getConditionNumber();

Source Link

Document

Return the condition number of the matrix.

Usage

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

/**
 * @param svd The result of the SV decomposition, not null
 *//*from www .  j  a v a2 s  . c o m*/
public SVDecompositionCommonsResult(final SingularValueDecomposition svd) {
    Validate.notNull(svd);
    _condition = svd.getConditionNumber();
    _norm = svd.getNorm();
    _rank = svd.getRank();
    _s = CommonsMathWrapper.unwrap(svd.getS());
    _singularValues = svd.getSingularValues();
    _u = CommonsMathWrapper.unwrap(svd.getU());
    _uTranspose = CommonsMathWrapper.unwrap(svd.getUT());
    _v = CommonsMathWrapper.unwrap(svd.getV());
    _vTranspose = CommonsMathWrapper.unwrap(svd.getVT());
    _solver = svd.getSolver();
}

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

/**
 * {@inheritDoc}//from   w  w  w  .ja v  a  2 s  .  c om
 */
@Override
public double getCondition(final Matrix<?> m) {
    Validate.notNull(m, "m");
    if (m instanceof DoubleMatrix2D) {
        final RealMatrix temp = CommonsMathWrapper.wrap((DoubleMatrix2D) m);
        final SingularValueDecomposition svd = new SingularValueDecompositionImpl(temp);
        return svd.getConditionNumber();
    }
    throw new IllegalArgumentException(
            "Can only find condition number of DoubleMatrix2D; have " + m.getClass());
}