org.apache.commons.math.exception.NumberIsTooSmallException Java Examples

The following examples show how to use org.apache.commons.math.exception.NumberIsTooSmallException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Nopol2017_0067_t.java    From coming with MIT License 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                minStep, FastMath.abs(h), true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example #2
Source File: Nopol2017_0067_t.java    From coming with MIT License 6 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws DimensionMismatchException, NumberIsTooSmallException {

    super.sanityChecks(equations, t);

    mainSetDimension = equations.getPrimaryMapper().getDimension();

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new DimensionMismatchException(mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new DimensionMismatchException(mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example #3
Source File: Nopol2017_0067_s.java    From coming with MIT License 6 votes vote down vote up
/** Filter the integration step.
 * @param h signed step
 * @param forward forward integration indicator
 * @param acceptSmall if true, steps smaller than the minimal value
 * are silently increased up to this value, if false such small
 * steps generate an exception
 * @return a bounded integration step (h if no bound is reach, or a bounded value)
 * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
 */
protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
  throws NumberIsTooSmallException {

    double filteredH = h;
    if (FastMath.abs(h) < minStep) {
        if (acceptSmall) {
            filteredH = forward ? minStep : -minStep;
        } else {
            throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
                                                minStep, FastMath.abs(h), true);
        }
    }

    if (filteredH > maxStep) {
        filteredH = maxStep;
    } else if (filteredH < -maxStep) {
        filteredH = -maxStep;
    }

    return filteredH;

}
 
Example #4
Source File: Nopol2017_0067_s.java    From coming with MIT License 6 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws DimensionMismatchException, NumberIsTooSmallException {

    super.sanityChecks(equations, t);

    mainSetDimension = equations.getPrimaryMapper().getDimension();

    if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
        throw new DimensionMismatchException(mainSetDimension, vecAbsoluteTolerance.length);
    }

    if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
        throw new DimensionMismatchException(mainSetDimension, vecRelativeTolerance.length);
    }

}
 
Example #5
Source File: Nopol2017_0071_s.java    From coming with MIT License 5 votes vote down vote up
/** Check the integration span.
 * @param equations set of differential equations
 * @param t target time for the integration
 * @exception NumberIsTooSmallException if integration span is too small
 */
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws NumberIsTooSmallException {

    final double threshold = 1000 * FastMath.ulp(FastMath.max(FastMath.abs(equations.getTime()),
                                                              FastMath.abs(t)));
    final double dt = FastMath.abs(equations.getTime() - t);
    if (dt <= threshold) {
        throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                                            dt, threshold, false);
    }

}
 
Example #6
Source File: Math_40_BracketingNthOrderBrentSolver_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #7
Source File: arja9_nine_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Constructs instance with the specified observed points.
 *
 * @param observations observed points upon which should base guess
 */
public ParameterGuesser(WeightedObservedPoint[] observations) {
    if (observations == null) {
        throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
    }
    if (observations.length < 3) {
        throw new NumberIsTooSmallException(observations.length, 3, true);
    }
    this.observations = observations.clone();
}
 
Example #8
Source File: Math_40_BracketingNthOrderBrentSolver_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #9
Source File: Math_44_AbstractIntegrator_s.java    From coming with MIT License 5 votes vote down vote up
/** Check the integration span.
 * @param equations set of differential equations
 * @param t target time for the integration
 * @exception NumberIsTooSmallException if integration span is too small
 */
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws NumberIsTooSmallException {

    final double threshold = 1000 * FastMath.ulp(FastMath.max(FastMath.abs(equations.getTime()),
                                                              FastMath.abs(t)));
    final double dt = FastMath.abs(equations.getTime() - t);
    if (dt <= threshold) {
        throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                                            dt, threshold, false);
    }

}
 
Example #10
Source File: Math_40_BracketingNthOrderBrentSolver_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #11
Source File: Math_40_BracketingNthOrderBrentSolver_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #12
Source File: Math_40_BracketingNthOrderBrentSolver_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #13
Source File: Math_58_GaussianFitter_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Constructs instance with the specified observed points.
 *
 * @param observations observed points upon which should base guess
 */
public ParameterGuesser(WeightedObservedPoint[] observations) {
    if (observations == null) {
        throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
    }
    if (observations.length < 3) {
        throw new NumberIsTooSmallException(observations.length, 3, true);
    }
    this.observations = observations.clone();
}
 
Example #14
Source File: Math_58_GaussianFitter_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Constructs instance with the specified observed points.
 *
 * @param observations observed points upon which should base guess
 */
public ParameterGuesser(WeightedObservedPoint[] observations) {
    if (observations == null) {
        throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
    }
    if (observations.length < 3) {
        throw new NumberIsTooSmallException(observations.length, 3, true);
    }
    this.observations = observations.clone();
}
 
Example #15
Source File: Math_40_BracketingNthOrderBrentSolver_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #16
Source File: Nopol2017_0068_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #17
Source File: Nopol2017_0071_t.java    From coming with MIT License 5 votes vote down vote up
/** Check the integration span.
 * @param equations set of differential equations
 * @param t target time for the integration
 * @exception NumberIsTooSmallException if integration span is too small
 */
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws NumberIsTooSmallException {

    final double threshold = 1000 * FastMath.ulp(FastMath.max(FastMath.abs(equations.getTime()),
                                                              FastMath.abs(t)));
    final double dt = FastMath.abs(equations.getTime() - t);
    if (dt <= threshold) {
        throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                                            dt, threshold, false);
    }

}
 
Example #18
Source File: JGenProg2017_0062_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #19
Source File: JGenProg2017_0062_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #20
Source File: JGenProg2017_0062_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #21
Source File: JGenProg2017_0062_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #22
Source File: JGenProg2017_0062_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #23
Source File: JGenProg2017_0062_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #24
Source File: JGenProg2017_0091_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #25
Source File: JGenProg2017_0091_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #26
Source File: JGenProg2017_0091_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #27
Source File: JGenProg2017_0091_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param functionValueAccuracy Function value accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final double functionValueAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #28
Source File: JGenProg2017_0091_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param relativeAccuracy Relative accuracy.
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
                                     final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(relativeAccuracy, absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #29
Source File: JGenProg2017_0091_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}
 
Example #30
Source File: 1_BracketingNthOrderBrentSolver.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a solver.
 *
 * @param absoluteAccuracy Absolute accuracy.
 * @param maximalOrder maximal order.
 * @exception NumberIsTooSmallException if maximal order is lower than 2
 */
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
                                     final int maximalOrder)
    throws NumberIsTooSmallException {
    super(absoluteAccuracy);
    if (maximalOrder < 2) {
        throw new NumberIsTooSmallException(maximalOrder, 2, true);
    }
    this.maximalOrder = maximalOrder;
    this.allowed = AllowedSolution.ANY_SIDE;
}