commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: svn commit: r1411807 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/optimization/ test/java/org/apache/commons/math3/optimization/fitting/
Date Thu, 22 Nov 2012 23:16:36 GMT
> > +     * If {@link #maxIterationCount} is set to this value, the number of
> > +     * iterations will never cause {@link #converged(int,Pair,Pair>)}
> > +     * to return {@code true}.
> > +     */
> > +    private static final int ITERATION_CHECK_DISABLED = -1;
> Could be I am misunderstanding the setup here, but I think this
> value may cause a problem with the positivity check below (i.e.
> using it will raise NotStrictlyPostiveException).

No, there is a check (and possible throw) only in the constructor that has
this parameter.
In the others, the value ITERATION_CHECK_DISABLED is directly assigned, and
the method "converged" checks "maxIterationCount" only if it is not equal

>  The test at the
> end does not test using this value.  IIUC the code, a test that did
> would throw.  Might be better to use Integer.MAX_VALUE or a boolean
> flag.

A boolean flag would be clearer, I agree, but there would have to be one per
object, whereas here we can get away with just one additional class

>  Also, javadoc says negative values for maxIter disable.  The
> code actually throws.

A negative value is just wrong, and it should raise an exception.
To disable, one has to create an instance with the other constructor.  I'll
correct the doc.


> [...]

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message