Package org.apache.commons.math

Examples of org.apache.commons.math.FunctionEvaluationException


    public double value(final double[] point) throws FunctionEvaluationException {

        // compute residuals
        final double[] residuals = function.value(point);
        if (residuals.length != observations.length) {
            throw new FunctionEvaluationException(point,LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                        residuals.length, observations.length);
        }
        for (int i = 0; i < residuals.length; ++i) {
            residuals[i] -= observations[i];
        }
View Full Code Here


     * @exception IllegalArgumentException if the start point dimension is wrong
     */
    protected double evaluate(final double[] x)
        throws FunctionEvaluationException, IllegalArgumentException {
        if (++evaluations > maxEvaluations) {
            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), x);
        }
        return f.value(x);
    }
View Full Code Here

     */
    protected void updateJacobian() throws FunctionEvaluationException {
        ++jacobianEvaluations;
        jacobian = jF.value(point);
        if (jacobian.length != rows) {
            throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                                  jacobian.length, rows);
        }
        for (int i = 0; i < rows; i++) {
            final double[] ji = jacobian[i];
            double wi = FastMath.sqrt(residualsWeights[i]);
View Full Code Here

     */
    protected void updateResidualsAndCost()
        throws FunctionEvaluationException {

        if (++objectiveEvaluations > maxEvaluations) {
            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),
                                                  point);
        }
        objective = function.value(point);
        if (objective.length != rows) {
            throw new FunctionEvaluationException(point, LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
                                                  objective.length, rows);
        }
        cost = 0;
        int index = 0;
        for (int i = 0; i < rows; i++) {
View Full Code Here

     * of iterations is exceeded
     */
    protected double computeObjectiveValue(final double[] evaluationPoint)
        throws FunctionEvaluationException {
        if (++evaluations > maxEvaluations) {
            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),
                                                  evaluationPoint);
        }
        return function.value(evaluationPoint);
    }
View Full Code Here

     * of the spline function (less than the smallest knot point or greater
     * than the largest knot point)
     */
    public double value(double v) throws FunctionEvaluationException {
        if (v < knots[0] || v > knots[n]) {
            throw new FunctionEvaluationException(v,"Argument outside domain");
        }
        int i = Arrays.binarySearch(knots, v);
        if (i < 0) {
            i = -i - 2;
        }
View Full Code Here

            public double value(double x) throws FunctionEvaluationException {
                try {
                    return cumulativeProbability(x) - p;
                } catch (MathException ex) {
                    throw new FunctionEvaluationException
                        (x, "Error computing cdf", ex);
                }
            }
        };
             
View Full Code Here

        optimizer.optimize(new DifferentiableMultivariateVectorialFunction() {
                public MultivariateMatrixFunction jacobian() {
                    return null;
                }
                public double[] value(double[] point) throws FunctionEvaluationException {
                    throw new FunctionEvaluationException(point);
                }
            }, new double[] { 2 }, new double[] { 1 }, new double[] { 0 });
    }
View Full Code Here

    @Deprecated
    protected double computeObjectiveValue(final UnivariateRealFunction f,
                                           final double point)
        throws FunctionEvaluationException {
        if (++evaluations > maxEvaluations) {
            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), point);
        }
        return f.value(point);
    }
View Full Code Here

     */
    protected double computeObjectiveValue(double point)
        throws FunctionEvaluationException {
        if (++evaluations > maxEvaluations) {
            resultComputed = false;
            throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations), point);
        }
        return function.value(point);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math.FunctionEvaluationException

Copyright © 2018 www.massapicom. 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.