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

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

Introduction

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

Prototype

public RRQRDecomposition(RealMatrix matrix, double threshold) 

Source Link

Document

Calculates the QR-decomposition of the given matrix.

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  av  a2s . c  o  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  . ja va2  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  v a  2s .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);
}

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

public boolean isNonSingular(RealMatrix M) {
    QRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();

    return solver.isNonSingular();
}

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

@Override
public boolean isNonSingular(RealMatrix M) {
    QRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();
    return solver.isNonSingular();
}

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

public boolean isNonSingular(RealMatrix M) {
    QRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();
    return solver.isNonSingular();
}