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

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

Introduction

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

Prototype

public double getNorm() 

Source Link

Document

Returns the L2 norm 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 ww. java  2  s .c o  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 getNorm2(Matrix m) {
    ArgChecker.notNull(m, "m");
    if (m instanceof DoubleArray) {
        RealVector temp = CommonsMathWrapper.wrap((DoubleArray) m);
        return temp.getNorm();
    } else if (m instanceof DoubleMatrix) {
        RealMatrix temp = CommonsMathWrapper.wrap((DoubleMatrix) m);
        SingularValueDecomposition svd = new SingularValueDecomposition(temp);
        return svd.getNorm();
    }/*from  ww  w.  j  a v  a 2 s.  c o m*/
    throw new IllegalArgumentException("Can only find norm2 of DoubleMatrix; have " + m.getClass());
}