Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#TOO_SMALL_INTEGRATION_INTERVAL

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#TOO_SMALL_INTEGRATION_INTERVAL . 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: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 2
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 3
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 4
Source File: AbstractIntegrator.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Perform some sanity checks on the integration parameters.
 * @param ode differential equations set
 * @param t0 start time
 * @param y0 state vector at t0
 * @param t target time for the integration
 * @param y placeholder where to put the state vector
 * @exception IntegratorException if some inconsistency is detected
 */
protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                            final double t0, final double[] y0,
                            final double t, final double[] y)
    throws IntegratorException {

    if (ode.getDimension() != y0.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
    }

    if (ode.getDimension() != y.length) {
        throw new IntegratorException(
                LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
    }

    if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
        throw new IntegratorException(
                LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                FastMath.abs(t - t0));
    }

}
 
Example 5
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 6
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 7
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 8
Source File: Math_44_AbstractIntegrator_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);
    }

}