System.arraycopy(y0, 0, y, 0, n);
}
final double[] yDot = new double[y0.length];
final double[] yTmp = new double[y0.length];
final double[] predictedScaled = new double[y0.length];
Array2DRowRealMatrix nordsieckTmp = null;
// set up two interpolators sharing the integrator arrays
final NordsieckStepInterpolator interpolator = new NordsieckStepInterpolator();
interpolator.reinitialize(y, forward);
// set up integration control objects
for (StepHandler handler : stepHandlers) {
handler.reset();
}
setStateInitialized(false);
// compute the initial Nordsieck vector using the configured starter integrator
start(t0, y, t);
interpolator.reinitialize(stepStart, stepSize, scaled, nordsieck);
interpolator.storeTime(stepStart);
double hNew = stepSize;
interpolator.rescale(hNew);
isLastStep = false;
do {
double error = 10;
while (error >= 1.0) {
stepSize = hNew;
// predict a first estimate of the state at step end (P in the PECE sequence)
final double stepEnd = stepStart + stepSize;
interpolator.setInterpolatedTime(stepEnd);
System.arraycopy(interpolator.getInterpolatedState(), 0, yTmp, 0, y0.length);
// evaluate a first estimate of the derivative (first E in the PECE sequence)
computeDerivatives(stepEnd, yTmp, yDot);
// update Nordsieck vector
for (int j = 0; j < y0.length; ++j) {
predictedScaled[j] = stepSize * yDot[j];
}
nordsieckTmp = updateHighOrderDerivativesPhase1(nordsieck);
updateHighOrderDerivativesPhase2(scaled, predictedScaled, nordsieckTmp);
// apply correction (C in the PECE sequence)
error = nordsieckTmp.walkInOptimizedOrder(new Corrector(y, predictedScaled, yTmp));
if (error >= 1.0) {
// reject the step and attempt to reduce error by stepsize control
final double factor = computeStepGrowShrinkFactor(error);
hNew = filterStep(stepSize * factor, forward, false);