Examples of ConvergenceException


Examples of net.sf.doodleproject.numerics4j.exception.ConvergenceException

            state.iterate();
        } while (state.getIterations() < getMaximumIterations()
            && Math.abs(state.getRelativeError()) > getMaximumRelativeError());

        if (state.getIterations() >= getMaximumIterations()) {
            throw new ConvergenceException(
                "Iterative method failed to converge.");
        }
    }
View Full Code Here

Examples of net.sf.doodleproject.numerics4j.exception.ConvergenceException

            s = sn;
        } while (n < getMaximumIterations()
            && Math.abs(error) > getMaximumRelativeError());

        if (n >= getMaximumIterations()) {
            throw new ConvergenceException("Power series failed to converge.");
        }

        return s;
    }
View Full Code Here

Examples of net.sf.doodleproject.numerics4j.exception.ConvergenceException

                fa = getFunction().evaluate(a);
                fb = getFunction().evaluate(b);
            } while ((fa * fb > 0.0) && (n < getMaximumIterations()));

            if (n >= getMaximumIterations()) {
                throw new ConvergenceException(
                    "the initial bounds do not bracket a root.");
            }

            ret = new double[] { a, b };
        }
View Full Code Here

Examples of net.sf.doodleproject.numerics4j.exception.ConvergenceException

            f1 = f;
        } while (n < getMaximumIterations()
            && error > getMaximumRelativeError());

        if (n >= getMaximumIterations()) {
            throw new ConvergenceException("Secant method failed to converge.");
        }

        return x1;
    }
View Full Code Here

Examples of net.sf.doodleproject.numerics4j.exception.ConvergenceException

            ++n;
        } while (n < getMaximumIterations()
            && error > getMaximumRelativeError());

        if (n >= getMaximumIterations()) {
            throw new ConvergenceException(
                "False position method failed to converge.");
        }

        return x;
    }
View Full Code Here

Examples of org.apache.commons.math.ConvergenceException

                double scaleFactor = 1d;
                double lastScaleFactor = 1d;
                final int maxPower = 5;
                final double scale = FastMath.max(a,b);
                if (scale <= 0) {  // Can't scale
                    throw new ConvergenceException(
                            LocalizedFormats.CONTINUED_FRACTION_INFINITY_DIVERGENCE,
                             x);
                }
                infinite = true;
                for (int i = 0; i < maxPower; i++) {
                    lastScaleFactor = scaleFactor;
                    scaleFactor *= scale;
                    if (a != 0.0 && a > b) {
                        p2 = p1 / lastScaleFactor + (b / scaleFactor * p0);
                        q2 = q1 / lastScaleFactor + (b / scaleFactor * q0);
                    } else if (b != 0) {
                        p2 = (a / scaleFactor * p1) + p0 / lastScaleFactor;
                        q2 = (a / scaleFactor * q1) + q0 / lastScaleFactor;
                    }
                    infinite = Double.isInfinite(p2) || Double.isInfinite(q2);
                    if (!infinite) {
                        break;
                    }
                }
            }

            if (infinite) {
               // Scaling failed
               throw new ConvergenceException(
                 LocalizedFormats.CONTINUED_FRACTION_INFINITY_DIVERGENCE,
                  x);
            }

            double r = p2 / q2;

            if (Double.isNaN(r)) {
                throw new ConvergenceException(
                  LocalizedFormats.CONTINUED_FRACTION_NAN_DIVERGENCE,
                  x);
            }
            relativeError = FastMath.abs(r / c - 1.0);

View Full Code Here

Examples of org.apache.commons.math.ConvergenceException

            numIterations++ ;
        } while ((fa * fb > 0.0) && (numIterations < maximumIterations) &&
                ((a > lowerBound) || (b < upperBound)));

        if (fa * fb > 0.0 ) {
            throw new ConvergenceException(
                      LocalizedFormats.FAILED_BRACKETING,
                      numIterations, maximumIterations, initial,
                      lowerBound, upperBound, a, b, fa, fb);
        }

View Full Code Here

Examples of org.apache.commons.math.ConvergenceException

                return result;
            }
        }

        // should never happen
        throw new ConvergenceException();
    }
View Full Code Here

Examples of org.apache.commons.math.exception.ConvergenceException

                            break;
                        case FARTHEST_POINT :
                            newCenter = getFarthestPoint(clusters);
                            break;
                        default :
                            throw new ConvergenceException(LocalizedFormats.EMPTY_CLUSTER_IN_K_MEANS);
                    }
                    clusteringChanged = true;
                } else {
                    newCenter = cluster.getCenter().centroidOf(cluster.getPoints());
                    if (!newCenter.equals(cluster.getCenter())) {
View Full Code Here

Examples of org.apache.commons.math3.exception.ConvergenceException

                // tests for termination and stringent tolerances
                if (FastMath.abs(actRed) <= TWO_EPS &&
                    preRed <= TWO_EPS &&
                    ratio <= 2.0) {
                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE,
                                                   costRelativeTolerance);
                } else if (delta <= TWO_EPS * xNorm) {
                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE,
                                                   parRelativeTolerance);
                } else if (maxCosine <= TWO_EPS) {
                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE,
                                                   orthoTolerance);
                }
            }
        }
    }
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.