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

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

Introduction

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

Prototype

double getNorm();

Source Link

Document

Returns the L2 norm 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   w  w  w. j  av  a  2s  .c om*/
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.j a v a2  s.  com
 */
@Override
public double getNorm2(final Matrix<?> m) {
    Validate.notNull(m, "m");
    if (m instanceof DoubleMatrix1D) {
        final RealVector temp = CommonsMathWrapper.wrap((DoubleMatrix1D) m);
        return temp.getNorm();
    } else if (m instanceof DoubleMatrix2D) {
        final RealMatrix temp = CommonsMathWrapper.wrap((DoubleMatrix2D) m);
        final SingularValueDecomposition svd = new SingularValueDecompositionImpl(temp);
        return svd.getNorm();
    }
    throw new IllegalArgumentException("Can only find norm2 of DoubleMatrix2D; have " + m.getClass());
}