Example usage for org.apache.commons.math3.linear RRQRDecomposition getRank

List of usage examples for org.apache.commons.math3.linear RRQRDecomposition getRank

Introduction

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

Prototype

public int getRank(final double dropThreshold) 

Source Link

Document

Return the effective numerical matrix rank.

Usage

From source file:com.anhth12.lambda.common.math.LinearSystemSolver.java

public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }/* w  w  w  . j av  a  2s . c om*/

    RRQRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);

    DecompositionSolver solver = decomposition.getSolver();
    if (solver.isNonSingular()) {
        return new Solver(solver);
    }
    int apparentRank = decomposition.getRank(0.01);

    log.warn(
            "{} x {} matrix is near-singular (threshold {}). Add more data or decrease the "
                    + "value of als.hyperparams.features, to <= about {}",
            M.getRowDimension(), M.getColumnDimension(), SINGULARITY_THRESHOLD, apparentRank);
    throw new SingularMatrixSolverException(apparentRank, "Apparent rank: " + apparentRank);
}

From source file:com.cloudera.oryx.common.math.LinearSystemSolver.java

public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }/*ww  w. ja v a2s. com*/
    RRQRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();
    if (solver.isNonSingular()) {
        return new Solver(solver);
    }
    // Otherwise try to report apparent rank
    int apparentRank = decomposition.getRank(0.01); // Better value?
    log.warn(
            "{} x {} matrix is near-singular (threshold {}). Add more data or decrease the "
                    + "value of als.hyperparams.features, to <= about {}",
            M.getRowDimension(), M.getColumnDimension(), SINGULARITY_THRESHOLD, apparentRank);
    throw new SingularMatrixSolverException(apparentRank, "Apparent rank: " + apparentRank);
}

From source file:com.cloudera.oryx.common.math.CommonsMathLinearSystemSolver.java

@Override
public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }//  w  ww. j a v  a  2  s .  co  m
    RRQRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();
    if (solver.isNonSingular()) {
        return new CommonsMathSolver(solver);
    }
    // Otherwise try to report apparent rank
    int apparentRank = decomposition.getRank(0.01); // Better value?
    log.warn(
            "{} x {} matrix is near-singular (threshold {}). Add more data or decrease the value of model.features, "
                    + "to <= about {}",
            M.getRowDimension(), M.getColumnDimension(), SINGULARITY_THRESHOLD, apparentRank);
    throw new SingularMatrixSolverException(apparentRank, "Apparent rank: " + apparentRank);
}