Combined nested if statements.

This commit is contained in:
Luc Maisonobe 2015-11-03 21:43:57 +01:00
parent 1130658baf
commit 63a179da8b
2 changed files with 9 additions and 11 deletions

View File

@ -213,10 +213,10 @@ public class EnumeratedDistribution<T> implements Serializable {
index = -index-1;
}
if (index >= 0 && index < probabilities.length) {
if (randomValue < cumulativeProbabilities[index]) {
return singletons.get(index);
}
if (index >= 0 &&
index < probabilities.length &&
randomValue < cumulativeProbabilities[index]) {
return singletons.get(index);
}
/* This should never happen, but it ensures we will return a correct

View File

@ -234,13 +234,11 @@ public class GaussNewtonOptimizer implements LeastSquaresOptimizer {
currentPoint = current.getPoint();
// Check convergence.
if (previous != null) {
if (checker.converged(iterationCounter.getCount(), previous, current)) {
return new OptimumImpl(
current,
evaluationCounter.getCount(),
iterationCounter.getCount());
}
if (previous != null &&
checker.converged(iterationCounter.getCount(), previous, current)) {
return new OptimumImpl(current,
evaluationCounter.getCount(),
iterationCounter.getCount());
}
// solve the linearized least squares problem