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

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

Introduction

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

Prototype

@Override
public DecompositionSolver getSolver() 

Source Link

Document

Get a solver for finding the A × X = B solution in least square sense.

Usage

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

public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }/*from   ww  w  .  j a v a2  s .co  m*/

    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.CommonsMathLinearSystemSolver.java

@Override
public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }/* w  ww  . j av a 2  s.c  o 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);
}

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

public Solver getSolver(RealMatrix M) {
    if (M == null) {
        return null;
    }/*from  w w w  .j  a va2 s . c o m*/
    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);
}