Package org.apache.commons.math

Examples of org.apache.commons.math.MathException


     * </ul>
     */
    public final double[] smooth(final double[] xval, final double[] yval)
            throws MathException {
        if (xval.length != yval.length) {
            throw new MathException(
                    "Loess expects the abscissa and ordinate arrays " +
                    "to be of the same size, " +
                    "but got {0} abscissae and {1} ordinatae",
                    xval.length, yval.length);
        }
View Full Code Here


    private static void checkAllFiniteReal(final double[] values, final String pattern)
        throws MathException {
        for (int i = 0; i < values.length; i++) {
            final double x = values[i];
            if (Double.isInfinite(x) || Double.isNaN(x)) {
                throw new MathException(pattern, i, x);
            }
        }
    }
View Full Code Here

     */
    private static void checkStrictlyIncreasing(final double[] xval)
        throws MathException {
        for (int i = 0; i < xval.length; ++i) {
            if (i >= 1 && xval[i - 1] >= xval[i]) {
                throw new MathException(
                        "the abscissae array must be sorted in a strictly " +
                        "increasing order, but the {0}-th element is {1} " +
                        "whereas {2}-th is {3}",
                        i - 1, xval[i - 1], i, xval[i]);
            }
View Full Code Here

     * @see <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/Transformer.html"/>
     */
    public double transform(Object o) throws MathException{

        if (o == null) {
            throw new MathException("Conversion Exception in Transformation, Object is null");
        }

        if (o instanceof Number) {
            return ((Number)o).doubleValue();
        }

        try {
            return Double.valueOf(o.toString()).doubleValue();
        } catch (NumberFormatException e) {
            throw new MathException(e,
                                    "Conversion Exception in Transformation: {0}", e.getMessage());
        }
    }
View Full Code Here

            }
            if (Math.abs(rootFindingFunction.value(upperBound)) < getSolverAbsoluteAccuracy()) {
                return upperBound;
            }
            // Failed bracket convergence was not because of corner solution
            throw new MathException(ex);
        }

        // find root
        double root = UnivariateRealSolverUtils.solve(rootFindingFunction,
                // override getSolverAbsoluteAccuracy() to use a Brent solver with
View Full Code Here

     * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
     */
    public double transform(Object o) throws MathException{

        if (o == null) {
            throw new MathException("Conversion Exception in Transformation, Object is null", new Object[0]);
        }

        if (o instanceof Number) {
            return ((Number)o).doubleValue();
        }
           
        try {
            return new Double(o.toString()).doubleValue();
        } catch (Exception e) {
            throw new MathException("Conversion Exception in Transformation: {0}",
                                    new Object[] { e.getMessage() }, e);
        }
    }
View Full Code Here

            }
            if (Math.abs(rootFindingFunction.value(upperBound)) < 1E-6) {
                return upperBound;
            }    
            // Failed bracket convergence was not because of corner solution
            throw new MathException(ex);
        }

        // find root
        double root = UnivariateRealSolverUtils.solve(rootFindingFunction,
                bracket[0],bracket[1]);
View Full Code Here

TOP

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

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.