Examples of DecompositionSolver


Examples of org.apache.commons.math3.linear.DecompositionSolver

        // Compute transpose(J)J.
        final RealMatrix jTj = j.transpose().multiply(j);

        // Compute the covariances matrix.
        final DecompositionSolver solver
            = new QRDecomposition(jTj, threshold).getSolver();
        return solver.getInverse().getData();
    }
View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

            }

            try {
                // solve the linearized least squares problem
                RealMatrix mA = new BlockRealMatrix(a);
                DecompositionSolver solver = useLU ?
                        new LUDecomposition(mA).getSolver() :
                        new QRDecomposition(mA).getSolver();
                final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
                // update the estimated parameters
                for (int i = 0; i < nC; ++i) {
                    currentPoint[i] += dX[i];
                }
            } catch (SingularMatrixException e) {
View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

        // Compute transpose(J)J.
        final RealMatrix jTj = j.transpose().multiply(j);

        // Compute the covariances matrix.
        final DecompositionSolver solver
            = new QRDecomposition(jTj, threshold).getSolver();
        return solver.getInverse().getData();
    }
View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

            }

            try {
                // solve the linearized least squares problem
                RealMatrix mA = new BlockRealMatrix(a);
                DecompositionSolver solver = useLU ?
                        new LUDecomposition(mA).getSolver() :
                        new QRDecomposition(mA).getSolver();
                final double[] dX = solver.solve(new ArrayRealVector(b, false)).toArray();
                // update the estimated parameters
                for (int i = 0; i < nC; ++i) {
                    currentPoint[i] += dX[i];
                }
            } catch (SingularMatrixException e) {
View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

     * are stored in As and Bs.
     */
    private void computeMllrTransforms(double[][][][][] regLs,
            double[][][][] regRs) {
        int len;
        DecompositionSolver solver;
        RealMatrix coef;
        RealVector vect, ABloc;

        for (int c = 0; c < nrOfClusters; c++) {
            this.As[c] = new float[loader.getNumStreams()][][];
            this.Bs[c] = new float[loader.getNumStreams()][];

            for (int i = 0; i < loader.getNumStreams(); i++) {
                len = loader.getVectorLength()[i];
                this.As[c][i] = new float[len][len];
                this.Bs[c][i] = new float[len];

                for (int j = 0; j < len; ++j) {
                    coef = new Array2DRowRealMatrix(regLs[c][i][j], false);
                    solver = new LUDecomposition(coef).getSolver();
                    vect = new ArrayRealVector(regRs[c][i][j], false);
                    ABloc = solver.solve(vect);

                    for (int k = 0; k < len; ++k) {
                        this.As[c][i][j][k] = (float) ABloc.getEntry(k);
                    }

View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

  public Solver getSolver(RealMatrix M) {
    if (M == null) {
      return null;
    }
    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 " +
View Full Code Here

Examples of org.apache.commons.math3.linear.DecompositionSolver

    throw new SingularMatrixSolverException(apparentRank, "Apparent rank: " + apparentRank);
 

  public boolean isNonSingular(RealMatrix M) {
    QRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);
    DecompositionSolver solver = decomposition.getSolver();
    return solver.isNonSingular();
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.