All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cern.colt.matrix.tdouble.algo.solver.CGLSDoubleIterationMonitor Maven / Gradle / Ivy

Go to download

Parallel Colt is a multithreaded version of Colt - a library for high performance scientific computing in Java. It contains efficient algorithms for data analysis, linear algebra, multi-dimensional arrays, Fourier transforms, statistics and histogramming.

The newest version!
package cern.colt.matrix.tdouble.algo.solver;

import cern.colt.matrix.tdouble.DoubleMatrix1D;

public class CGLSDoubleIterationMonitor extends DefaultDoubleIterationMonitor {

    protected boolean convergedI(double r) throws IterativeSolverDoubleNotConvergedException {
        // Store initial residual
        if (isFirst())
            initR = r;

        if (r <= rtol)
            return true;

        // Check for divergence
        if (r > dtol * initR)
            throw new IterativeSolverDoubleNotConvergedException(DoubleNotConvergedException.Reason.Divergence, this);
        if (iter >= maxIter)
            throw new IterativeSolverDoubleNotConvergedException(DoubleNotConvergedException.Reason.Iterations, this);
        if (Double.isNaN(r))
            throw new IterativeSolverDoubleNotConvergedException(DoubleNotConvergedException.Reason.Divergence, this);

        // Neither convergence nor divergence
        return false;
    }

    protected boolean convergedI(double r, DoubleMatrix1D x) throws IterativeSolverDoubleNotConvergedException {
        return convergedI(r);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy