/** Build an instance. * @param name name of the method */ public AbstractIntegrator(final String name) { this.name = name; stepHandlers = new ArrayList<StepHandler>(); stepStart = Double.NaN; stepSize = Double.NaN; eventsStates = new ArrayList<EventState>(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); }
/** Build an instance. * @param field field to which the time and state vector elements belong * @param name name of the method */ protected AbstractFieldIntegrator(final Field<T> field, final String name) { this.field = field; this.name = name; stepHandlers = new ArrayList<FieldStepHandler<T>>(); stepStart = null; stepSize = null; eventsStates = new ArrayList<FieldEventState<T>>(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); }
/** * Creates a new instance of this class. * * @param maxIterations the maximum number of iterations */ public IterationManager(final int maxIterations) { this.iterations = IntegerSequence.Incrementor.create().withMaximalCount(maxIterations); this.listeners = new CopyOnWriteArrayList<IterationListener>(); }
/** {@inheritDoc} */ public Iterator<Integer> iterator() { return Incrementor.create() .withStart(start) .withMaximalCount(max + (step > 0 ? 1 : -1)) .withIncrement(step); } }
/** * Creates a new instance of this class. * * @param maxIterations the maximum number of iterations */ public IterationManager(final int maxIterations) { this.iterations = IntegerSequence.Incrementor.create().withMaximalCount(maxIterations); this.listeners = new CopyOnWriteArrayList<IterationListener>(); }
/** {@inheritDoc} */ @Override public void setMaximalCount(int max) { super.setMaximalCount(max); delegate = delegate.withMaximalCount(max); }
/** Build an instance. * @param name name of the method */ public AbstractIntegrator(final String name) { this.name = name; stepHandlers = new ArrayList<StepHandler>(); stepStart = Double.NaN; stepSize = Double.NaN; eventsStates = new ArrayList<EventState>(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); }
/** {@inheritDoc} */ public Iterator<Integer> iterator() { return Incrementor.create() .withStart(start) .withMaximalCount(max + (step > 0 ? 1 : -1)) .withIncrement(step); } }
/** {@inheritDoc} */ @Override public void setMaximalCount(int max) { super.setMaximalCount(max); delegate = delegate.withMaximalCount(max); }
/** Build an instance. * @param name name of the method */ public AbstractIntegrator(final String name) { this.name = name; stepHandlers = new ArrayList<StepHandler>(); stepStart = Double.NaN; stepSize = Double.NaN; eventsStates = new ArrayList<EventState>(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); }
evaluations = evaluations.withMaximalCount(maxEval).withStart(0); T zero = field.getZero(); T nan = zero.add(Double.NaN);
this.count = IntegerSequence.Incrementor.create().withMaximalCount(maximalIterationCount);
/** * Prepare for computation. * Subclasses must call this method if they override any of the * {@code solve} methods. * * @param maxEval Maximum number of evaluations. * @param f the integrand function * @param lower the min bound for the interval * @param upper the upper bound for the interval * @throws NullArgumentException if {@code f} is {@code null}. * @throws MathIllegalArgumentException if {@code min >= max}. */ protected void setup(final int maxEval, final UnivariateFunction f, final double lower, final double upper) throws NullArgumentException, MathIllegalArgumentException { // Checks. MathUtils.checkNotNull(f); UnivariateSolverUtils.verifyInterval(lower, upper); // Reset. min = lower; max = upper; function = f; evaluations = evaluations.withMaximalCount(maxEval).withStart(0); count = count.withStart(0); }
/** * Prepare for computation. * Subclasses must call this method if they override any of the * {@code solve} methods. * * @param f Function to solve. * @param min Lower bound for the interval. * @param max Upper bound for the interval. * @param startValue Start value to use. * @param maxEval Maximum number of evaluations. * @exception NullArgumentException if f is null */ protected void setup(int maxEval, FUNC f, double min, double max, double startValue) throws NullArgumentException { // Checks. MathUtils.checkNotNull(f); // Reset. searchMin = min; searchMax = max; searchStart = startValue; function = f; evaluations = evaluations.withMaximalCount(maxEval).withStart(0); }
/** * Create a bracketing interval finder. * * @param growLimit Expanding factor. * @param maxEvaluations Maximum number of evaluations allowed for finding * a bracketing interval. */ public BracketFinder(double growLimit, int maxEvaluations) { if (growLimit <= 0) { throw new NotStrictlyPositiveException(growLimit); } if (maxEvaluations <= 0) { throw new NotStrictlyPositiveException(maxEvaluations); } this.growLimit = growLimit; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(maxEvaluations); }
/** * Creates a new instance of this class. * * @param maxIterations the maximum number of iterations * @param callBack the function to be called when the maximum number of * iterations has been reached * @throws org.apache.commons.math3.exception.NullArgumentException if {@code callBack} is {@code null} * @since 3.6 */ public IterationManager(final int maxIterations, final IntegerSequence.Incrementor.MaxCountExceededCallback callBack) { this.iterations = IntegerSequence.Incrementor.create().withMaximalCount(maxIterations).withCallback(callBack); this.listeners = new CopyOnWriteArrayList<IterationListener>(); }
/** {@inheritDoc} */ public void setMaxEvaluations(int maxEvaluations) { evaluations = evaluations.withMaximalCount((maxEvaluations < 0) ? Integer.MAX_VALUE : maxEvaluations); }
/** {@inheritDoc} */ public void setMaxEvaluations(int maxEvaluations) { evaluations = evaluations.withMaximalCount((maxEvaluations < 0) ? Integer.MAX_VALUE : maxEvaluations); }
/** {@inheritDoc} */ public Iterator<Integer> iterator() { return Incrementor.create() .withStart(start) .withMaximalCount(max + (step > 0 ? 1 : -1)) .withIncrement(step); } }
/** {@inheritDoc} */ @Override public void setMaximalCount(int max) { super.setMaximalCount(max); delegate = delegate.withMaximalCount(max); }