fixed another bunch of checkstyle warnings
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@981238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e24bdc331c
commit
accccd996a
|
@ -148,7 +148,7 @@ public class MicrosphereInterpolatingFunction
|
|||
int brightnessExponent,
|
||||
int microsphereElements,
|
||||
UnitSphereRandomVectorGenerator rand)
|
||||
throws DimensionMismatchException, IllegalArgumentException {
|
||||
throws DimensionMismatchException, NoDataException {
|
||||
if (xval.length == 0 || xval[0] == null) {
|
||||
throw new NoDataException();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.commons.math.optimization.SimpleScalarValueChecker;
|
|||
* A class that implements an optimization algorithm should inherit from
|
||||
* {@link AbstractScalarOptimizer} or from
|
||||
* {@link AbstractScalarDifferentiableOptimizer}.
|
||||
* @param <T> the type of the objective function to be optimized
|
||||
*
|
||||
* @version $Revision$ $Date$
|
||||
* @since 2.2
|
||||
|
@ -120,8 +121,8 @@ public abstract class BaseAbstractScalarOptimizer<T extends MultivariateRealFunc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void setConvergenceChecker(RealConvergenceChecker checker) {
|
||||
this.checker = checker;
|
||||
public void setConvergenceChecker(RealConvergenceChecker convergenceChecker) {
|
||||
this.checker = convergenceChecker;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -46,13 +46,13 @@ public abstract class AbstractUnivariateRealOptimizer
|
|||
/** Number of evaluations already performed. */
|
||||
private int evaluations;
|
||||
/** Optimization type */
|
||||
private GoalType goal;
|
||||
private GoalType optimizationGoal;
|
||||
/** Lower end of search interval. */
|
||||
private double min;
|
||||
private double searchMin;
|
||||
/** Higher end of search interval. */
|
||||
private double max;
|
||||
private double searchMax;
|
||||
/** Initial guess . */
|
||||
private double startValue;
|
||||
private double searchStart;
|
||||
/** Function to optimize. */
|
||||
private UnivariateRealFunction function;
|
||||
|
||||
|
@ -155,25 +155,25 @@ public abstract class AbstractUnivariateRealOptimizer
|
|||
* @return the optimization type.
|
||||
*/
|
||||
public GoalType getGoalType() {
|
||||
return goal;
|
||||
return optimizationGoal;
|
||||
}
|
||||
/**
|
||||
* @return the lower of the search interval.
|
||||
*/
|
||||
public double getMin() {
|
||||
return min;
|
||||
return searchMin;
|
||||
}
|
||||
/**
|
||||
* @return the higher of the search interval.
|
||||
*/
|
||||
public double getMax() {
|
||||
return max;
|
||||
return searchMax;
|
||||
}
|
||||
/**
|
||||
* @return the initial guess.
|
||||
*/
|
||||
public double getStartValue() {
|
||||
return startValue;
|
||||
return searchStart;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,15 +215,15 @@ public abstract class AbstractUnivariateRealOptimizer
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public double optimize(UnivariateRealFunction function, GoalType goal,
|
||||
public double optimize(UnivariateRealFunction f, GoalType goal,
|
||||
double min, double max, double startValue)
|
||||
throws MaxIterationsExceededException, FunctionEvaluationException {
|
||||
// Initialize.
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.startValue = startValue;
|
||||
this.goal = goal;
|
||||
this.function = function;
|
||||
this.searchMin = min;
|
||||
this.searchMax = max;
|
||||
this.searchStart = startValue;
|
||||
this.optimizationGoal = goal;
|
||||
this.function = f;
|
||||
|
||||
// Reset.
|
||||
functionValue = Double.NaN;
|
||||
|
|
|
@ -228,23 +228,52 @@ public class BracketFinder {
|
|||
|
||||
/**
|
||||
* @return the lower bound of the bracket.
|
||||
* @see #getFLow()
|
||||
*/
|
||||
public double getLo() {
|
||||
return lo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get function value at {@link #getLo()}.
|
||||
* @return function value at {@link #getLo()}
|
||||
*/
|
||||
public double getFLow() {
|
||||
return fLo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the higher bound of the bracket.
|
||||
* @see #getFHi()
|
||||
*/
|
||||
public double getHi() {
|
||||
return hi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get function value at {@link #getHi()}.
|
||||
* @return function value at {@link #getHi()}
|
||||
*/
|
||||
public double getFHi() {
|
||||
return fHi;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a point in the middle of the bracket.
|
||||
* @see #getFMid()
|
||||
*/
|
||||
public double getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get function value at {@link #getMid()}.
|
||||
* @return function value at {@link #getMid()}
|
||||
*/
|
||||
public double getFMid() {
|
||||
return fMid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param f Function.
|
||||
* @param x Argument.
|
||||
|
|
|
@ -1868,10 +1868,18 @@ public final class MathUtils {
|
|||
}
|
||||
|
||||
public static class Order {
|
||||
|
||||
/** Enumerate type for increasing/decreasing directions. */
|
||||
public static enum Direction {
|
||||
INCREASING,
|
||||
DECREASING
|
||||
|
||||
/** Constant for increasing direction. */
|
||||
INCREASING,
|
||||
|
||||
/** Constant for decreasing direction. */
|
||||
DECREASING
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,7 +140,7 @@ public class MultidimensionalCounter implements Iterable<Integer> {
|
|||
* of the iterator.
|
||||
* @throws IndexOutOfBoundsException if {@code index} is not in the
|
||||
* correct interval (as defined by the length of the argument in the
|
||||
* {@link #MultidimensionalCounter(int[])
|
||||
* {@link MultidimensionalCounter#MultidimensionalCounter(int[])
|
||||
* constructor of the enclosing class}).
|
||||
*/
|
||||
public int getCount(int dim) {
|
||||
|
@ -159,7 +159,7 @@ public class MultidimensionalCounter implements Iterable<Integer> {
|
|||
* Create a counter.
|
||||
*
|
||||
* @param size Counter sizes (number of slots in each dimension).
|
||||
* @throws {@link NotStrictlyPositiveException} if one of the sizes is
|
||||
* @throws NotStrictlyPositiveException if one of the sizes is
|
||||
* negative or zero.
|
||||
*/
|
||||
public MultidimensionalCounter(int ... size) {
|
||||
|
@ -210,12 +210,12 @@ public class MultidimensionalCounter implements Iterable<Integer> {
|
|||
*
|
||||
* @param index Index in unidimensional counter.
|
||||
* @return the multidimensional counts.
|
||||
* @throws {@link OutOfRangeException} if {@code index} is not between
|
||||
* @throws OutOfRangeException if {@code index} is not between
|
||||
* {@code 0} and the value returned by {@link #getSize()} (excluded).
|
||||
*/
|
||||
public int[] getCounts(int index) {
|
||||
if (index < 0
|
||||
|| index >= totalSize) {
|
||||
if (index < 0 ||
|
||||
index >= totalSize) {
|
||||
throw new OutOfRangeException(index, 0, totalSize);
|
||||
}
|
||||
|
||||
|
@ -250,21 +250,21 @@ public class MultidimensionalCounter implements Iterable<Integer> {
|
|||
*
|
||||
* @param c Indices in multidimensional counter.
|
||||
* @return the index within the unidimensionl counter.
|
||||
* @throws {@link DimensionMismatchException} if the size of {@code c}
|
||||
* does not match the size of the array given in the contructor.
|
||||
* @throws {@link OutOfRangeException} if a value of {@code c} is not in
|
||||
* @throws DimensionMismatchException if the size of {@code c}
|
||||
* does not match the size of the array given in the constructor.
|
||||
* @throws OutOfRangeException if a value of {@code c} is not in
|
||||
* the range of the corresponding dimension, as defined in the
|
||||
* {@link #MultidimensionalCounter(int[]) constructor}.
|
||||
* {@link MultidimensionalCounter#MultidimensionalCounter(int...) constructor}.
|
||||
*/
|
||||
public int getCount(int ... c) {
|
||||
public int getCount(int ... c) throws OutOfRangeException {
|
||||
if (c.length != dimension) {
|
||||
throw new DimensionMismatchException(c.length, dimension);
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < dimension; i++) {
|
||||
final int index = c[i];
|
||||
if (index < 0
|
||||
|| index >= size[i]) {
|
||||
if (index < 0 ||
|
||||
index >= size[i]) {
|
||||
throw new OutOfRangeException(index, 0, size[i] - 1);
|
||||
}
|
||||
count += uniCounterOffset[i] * c[i];
|
||||
|
|
Loading…
Reference in New Issue