Example usage for org.apache.commons.math.exception NumberIsTooLargeException NumberIsTooLargeException

List of usage examples for org.apache.commons.math.exception NumberIsTooLargeException NumberIsTooLargeException

Introduction

In this page you can find the example usage for org.apache.commons.math.exception NumberIsTooLargeException NumberIsTooLargeException.

Prototype

public NumberIsTooLargeException(Localizable specific, Number wrong, Number max, boolean boundIsAllowed) 

Source Link

Document

Construct the exception with a specific context.

Usage

From source file:jml.matlab.utils.SingularValueDecompositionImpl.java

/** {@inheritDoc} */
public RealMatrix getCovariance(final double minSingularValue) {
    // get the number of singular values to consider
    final int p = s.length;
    int dimension = 0;
    while ((dimension < p) && (s[dimension] >= minSingularValue)) {
        ++dimension;//from  w  w  w. j  a  v  a2  s  . c  om
    }

    if (dimension == 0) {
        throw new NumberIsTooLargeException(LocalizedFormats.TOO_LARGE_CUTOFF_SINGULAR_VALUE, minSingularValue,
                s[0], true);
    }

    final double[][] data = new double[dimension][p];
    getVT().walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {

        /** {@inheritDoc} */
        @Override
        public void visit(final int row, final int column, final double value) {
            data[row][column] = value / s[row];
        }
    }, 0, dimension - 1, 0, p - 1);

    RealMatrix jv = new Array2DRowRealMatrix(data, false);
    return jv.transpose().multiply(jv);
}