Combined nested if statements.
This commit is contained in:
parent
1130658baf
commit
63a179da8b
|
@ -213,11 +213,11 @@ 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 &&
|
||||||
|
randomValue < cumulativeProbabilities[index]) {
|
||||||
return singletons.get(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
|
||||||
* object in case there is some floating point inequality problem
|
* object in case there is some floating point inequality problem
|
||||||
|
|
|
@ -234,14 +234,12 @@ 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
|
||||||
final RealVector dX = this.decomposition.solve(weightedJacobian, currentResiduals);
|
final RealVector dX = this.decomposition.solve(weightedJacobian, currentResiduals);
|
||||||
|
|
Loading…
Reference in New Issue