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

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

Introduction

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

Prototype

public double getConditionNumber() 

Source Link

Document

Return the condition number of the matrix.

Usage

From source file:com.opengamma.strata.math.impl.linearalgebra.SVDecompositionCommonsResult.java

/**
 * @param svd The result of the SV decomposition, not null
 *//*from w w  w.j  a  v  a  2 s  . co  m*/
public SVDecompositionCommonsResult(SingularValueDecomposition svd) {
    ArgChecker.notNull(svd, "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.strata.math.impl.matrix.CommonsMatrixAlgebra.java

@Override
public double getCondition(Matrix m) {
    ArgChecker.notNull(m, "m");
    if (m instanceof DoubleMatrix) {
        RealMatrix temp = CommonsMathWrapper.wrap((DoubleMatrix) m);
        SingularValueDecomposition svd = new SingularValueDecomposition(temp);
        return svd.getConditionNumber();
    }//  w w w  .  j  a  v  a2  s.  c  om
    throw new IllegalArgumentException("Can only find condition number of DoubleMatrix; have " + m.getClass());
}

From source file:org.eclipse.dataset.LinearAlgebra.java

/**
 * Calculate condition number of matrix by singular value decomposition method
 * @param a/*from   www. ja  v  a2 s . com*/
 * @return condition number
 */
public static double calcConditionNumber(Dataset a) {
    SingularValueDecomposition svd = new SingularValueDecomposition(createRealMatrix(a));
    return svd.getConditionNumber();
}