当前位置: 首页>>代码示例>>Java>>正文


Java LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES属性的具体用法?Java LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES怎么用?Java LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


在下文中一共展示了LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: append

/** Append another model at the end of the instance.
 * @param model model to add at the end of the instance
 * @exception MathIllegalArgumentException if the model to append is not
 * compatible with the instance (dimension of the state vector,
 * propagation direction, hole between the dates)
 * @exception DimensionMismatchException if the dimensions of the states or
 * the number of secondary states do not match
 * @exception MaxCountExceededException if the number of functions evaluations is exceeded
 * during step finalization
 */
public void append(final ContinuousOutputFieldModel<T> model)
    throws MathIllegalArgumentException, MaxCountExceededException {

    if (model.steps.size() == 0) {
        return;
    }

    if (steps.size() == 0) {
        initialTime = model.initialTime;
        forward     = model.forward;
    } else {

        // safety checks
        final FieldODEStateAndDerivative<T> s1 = steps.get(0).getPreviousState();
        final FieldODEStateAndDerivative<T> s2 = model.steps.get(0).getPreviousState();
        checkDimensionsEquality(s1.getStateDimension(), s2.getStateDimension());
        checkDimensionsEquality(s1.getNumberOfSecondaryStates(), s2.getNumberOfSecondaryStates());
        for (int i = 0; i < s1.getNumberOfSecondaryStates(); ++i) {
            checkDimensionsEquality(s1.getSecondaryStateDimension(i), s2.getSecondaryStateDimension(i));
        }

        if (forward ^ model.forward) {
            throw new MathIllegalArgumentException(LocalizedFormats.PROPAGATION_DIRECTION_MISMATCH);
        }

        final FieldStepInterpolator<T> lastInterpolator = steps.get(index);
        final T current  = lastInterpolator.getCurrentState().getTime();
        final T previous = lastInterpolator.getPreviousState().getTime();
        final T step = current.subtract(previous);
        final T gap = model.getInitialTime().subtract(current);
        if (gap.abs().subtract(step.abs().multiply(1.0e-3)).getReal() > 0) {
            throw new MathIllegalArgumentException(LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES,
                                                   gap.abs().getReal());
        }

    }

    for (FieldStepInterpolator<T> interpolator : model.steps) {
        steps.add(interpolator);
    }

    index = steps.size() - 1;
    finalTime = (steps.get(index)).getCurrentState().getTime();

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:55,代码来源:ContinuousOutputFieldModel.java

示例2: append

/** Append another model at the end of the instance.
 * @param model model to add at the end of the instance
 * @exception MathIllegalArgumentException if the model to append is not
 * compatible with the instance (dimension of the state vector,
 * propagation direction, hole between the dates)
 * @exception MaxCountExceededException if the number of functions evaluations is exceeded
 * during step finalization
 */
public void append(final ContinuousOutputModel model)
  throws MathIllegalArgumentException, MaxCountExceededException {

  if (model.steps.size() == 0) {
    return;
  }

  if (steps.size() == 0) {
    initialTime = model.initialTime;
    forward     = model.forward;
  } else {

    if (getInterpolatedState().length != model.getInterpolatedState().length) {
        throw new DimensionMismatchException(model.getInterpolatedState().length,
                                             getInterpolatedState().length);
    }

    if (forward ^ model.forward) {
        throw new MathIllegalArgumentException(LocalizedFormats.PROPAGATION_DIRECTION_MISMATCH);
    }

    final StepInterpolator lastInterpolator = steps.get(index);
    final double current  = lastInterpolator.getCurrentTime();
    final double previous = lastInterpolator.getPreviousTime();
    final double step = current - previous;
    final double gap = model.getInitialTime() - current;
    if (FastMath.abs(gap) > 1.0e-3 * FastMath.abs(step)) {
      throw new MathIllegalArgumentException(LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES,
                                             FastMath.abs(gap));
    }

  }

  for (StepInterpolator interpolator : model.steps) {
    steps.add(interpolator.copy());
  }

  index = steps.size() - 1;
  finalTime = (steps.get(index)).getCurrentTime();

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:49,代码来源:ContinuousOutputModel.java


注:本文中的org.apache.commons.math3.exception.util.LocalizedFormats.HOLE_BETWEEN_MODELS_TIME_RANGES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。