Java源码示例:org.apache.commons.math.exception.NumberIsTooSmallException

示例1
/** {@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);
    }

}
 
示例2
/** 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;

}
 
示例3
/** {@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);
    }

}
 
示例4
/** 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;

}
 
示例5
/**
 * 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;
}
 
示例6
/**
 * 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;
}
 
示例7
/**
 * 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;
}
 
示例8
/**
 * 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();
}
 
示例9
/**
 * 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();
}
 
示例10
/**
 * 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;
}
 
示例11
/**
 * 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;
}
 
示例12
/**
 * 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;
}
 
示例13
/**
 * 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;
}
 
示例14
/**
 * 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;
}
 
示例15
/**
 * 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;
}
 
示例16
/**
 * 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;
}
 
示例17
/**
 * 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;
}
 
示例18
/** 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);
    }

}
 
示例19
/**
 * 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;
}
 
示例20
/**
 * 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;
}
 
示例21
/**
 * 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;
}
 
示例22
/**
 * 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;
}
 
示例23
/**
 * 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;
}
 
示例24
/**
 * 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;
}
 
示例25
/**
 * 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;
}
 
示例26
/**
 * 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;
}
 
示例27
/**
 * 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;
}
 
示例28
/**
 * 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;
}
 
示例29
/**
 * 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;
}
 
示例30
/**
 * 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;
}