Combined nested if statements.
This commit is contained in:
parent
1130658baf
commit
63a179da8b
|
@ -213,10 +213,10 @@ public class EnumeratedDistribution<T> implements Serializable {
|
||||||
index = -index-1;
|
index = -index-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= 0 && index < probabilities.length) {
|
if (index >= 0 &&
|
||||||
if (randomValue < cumulativeProbabilities[index]) {
|
index < probabilities.length &&
|
||||||
return singletons.get(index);
|
randomValue < cumulativeProbabilities[index]) {
|
||||||
}
|
return singletons.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This should never happen, but it ensures we will return a correct
|
/* This should never happen, but it ensures we will return a correct
|
||||||
|
|
|
@ -234,13 +234,11 @@ public class GaussNewtonOptimizer implements LeastSquaresOptimizer {
|
||||||
currentPoint = current.getPoint();
|
currentPoint = current.getPoint();
|
||||||
|
|
||||||
// Check convergence.
|
// Check convergence.
|
||||||
if (previous != null) {
|
if (previous != null &&
|
||||||
if (checker.converged(iterationCounter.getCount(), previous, current)) {
|
checker.converged(iterationCounter.getCount(), previous, current)) {
|
||||||
return new OptimumImpl(
|
return new OptimumImpl(current,
|
||||||
current,
|
evaluationCounter.getCount(),
|
||||||
evaluationCounter.getCount(),
|
iterationCounter.getCount());
|
||||||
iterationCounter.getCount());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// solve the linearized least squares problem
|
// solve the linearized least squares problem
|
||||||
|
|
Loading…
Reference in New Issue