|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.ConvergingAlgorithmImpl
public abstract class ConvergingAlgorithmImpl
Provide a default implementation for several functions useful to generic converging algorithms.
Field Summary | |
---|---|
protected double |
absoluteAccuracy
Deprecated. Maximum absolute error. |
protected double |
defaultAbsoluteAccuracy
Deprecated. Default maximum absolute error. |
protected int |
defaultMaximalIterationCount
Deprecated. Default maximum number of iterations. |
protected double |
defaultRelativeAccuracy
Deprecated. Default maximum relative error. |
protected int |
iterationCount
Deprecated. The last iteration count. |
protected int |
maximalIterationCount
Deprecated. Maximum number of iterations. |
protected double |
relativeAccuracy
Deprecated. Maximum relative error. |
Constructor Summary | |
---|---|
protected |
ConvergingAlgorithmImpl()
Deprecated. in 2.2 (to be removed as soon as the single non-default one has been removed). |
protected |
ConvergingAlgorithmImpl(int defaultMaximalIterationCount,
double defaultAbsoluteAccuracy)
Deprecated. in 2.2. Derived classes should use the "setter" methods in order to assign meaningful values to all the instances variables. |
Method Summary | |
---|---|
double |
getAbsoluteAccuracy()
Deprecated. Get the actual absolute accuracy. |
int |
getIterationCount()
Deprecated. Get the number of iterations in the last run of the algorithm. |
int |
getMaximalIterationCount()
Deprecated. Get the upper limit for the number of iterations. |
double |
getRelativeAccuracy()
Deprecated. Get the actual relative accuracy. |
protected void |
incrementIterationsCounter()
Deprecated. Increment the iterations counter by 1. |
void |
resetAbsoluteAccuracy()
Deprecated. Reset the absolute accuracy to the default. |
protected void |
resetIterationsCounter()
Deprecated. Reset the iterations counter to 0. |
void |
resetMaximalIterationCount()
Deprecated. Reset the upper limit for the number of iterations to the default. |
void |
resetRelativeAccuracy()
Deprecated. Reset the relative accuracy to the default. |
void |
setAbsoluteAccuracy(double accuracy)
Deprecated. Set the absolute accuracy. |
void |
setMaximalIterationCount(int count)
Deprecated. Set the upper limit for the number of iterations. |
void |
setRelativeAccuracy(double accuracy)
Deprecated. Set the relative accuracy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double absoluteAccuracy
protected double relativeAccuracy
protected int maximalIterationCount
protected double defaultAbsoluteAccuracy
protected double defaultRelativeAccuracy
protected int defaultMaximalIterationCount
protected int iterationCount
Constructor Detail |
---|
@Deprecated protected ConvergingAlgorithmImpl(int defaultMaximalIterationCount, double defaultAbsoluteAccuracy)
defaultAbsoluteAccuracy
- maximum absolute errordefaultMaximalIterationCount
- maximum number of iterations
IllegalArgumentException
- if f is null or the
defaultAbsoluteAccuracy is not valid@Deprecated protected ConvergingAlgorithmImpl()
Method Detail |
---|
public int getIterationCount()
This is mainly meant for testing purposes. It may occasionally help track down performance problems: if the iteration count is notoriously high, check whether the problem is evaluated properly, and whether another algorithm is more amenable to the problem.
getIterationCount
in interface ConvergingAlgorithm
public void setAbsoluteAccuracy(double accuracy)
The default is usually chosen so that results in the interval -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the expected absolute value of your results is of much smaller magnitude, set this to a smaller value.
Algorithms are advised to do a plausibility check with the relative accuracy, but clients should not rely on this.
setAbsoluteAccuracy
in interface ConvergingAlgorithm
accuracy
- the accuracy.public double getAbsoluteAccuracy()
getAbsoluteAccuracy
in interface ConvergingAlgorithm
public void resetAbsoluteAccuracy()
The default value is provided by the algorithm implementation.
resetAbsoluteAccuracy
in interface ConvergingAlgorithm
public void setMaximalIterationCount(int count)
Usually a high iteration count indicates convergence problems. However, the "reasonable value" varies widely for different algorithms. Users are advised to use the default value supplied by the algorithm.
A ConvergenceException
will be thrown if this number
is exceeded.
setMaximalIterationCount
in interface ConvergingAlgorithm
count
- maximum number of iterationspublic int getMaximalIterationCount()
getMaximalIterationCount
in interface ConvergingAlgorithm
public void resetMaximalIterationCount()
The default value is supplied by the algorithm implementation.
resetMaximalIterationCount
in interface ConvergingAlgorithm
ConvergingAlgorithm.setMaximalIterationCount(int)
public void setRelativeAccuracy(double accuracy)
This is used to stop iterations if the absolute accuracy can't be achieved due to large values or short mantissa length.
If this should be the primary criterion for convergence rather then a
safety measure, set the absolute accuracy to a ridiculously small value,
like MathUtils.SAFE_MIN
.
setRelativeAccuracy
in interface ConvergingAlgorithm
accuracy
- the relative accuracy.public double getRelativeAccuracy()
getRelativeAccuracy
in interface ConvergingAlgorithm
public void resetRelativeAccuracy()
resetRelativeAccuracy
in interface ConvergingAlgorithm
protected void resetIterationsCounter()
protected void incrementIterationsCounter() throws MaxIterationsExceededException
MaxIterationsExceededException
- if the maximal number
of iterations is exceeded.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |