MATH-1541: Loop early exit.

Closes #147.
This commit is contained in:
XenoAmess 2020-06-07 17:53:14 +08:00 committed by Gilles Sadowski
parent 2ba76c2573
commit bfa5b60eff
3 changed files with 4 additions and 1 deletions

View File

@ -1830,6 +1830,7 @@ public class Dfp implements RealFieldElement<Dfp> {
for (int i = mant.length - 1; i >= 0; i--) { for (int i = mant.length - 1; i >= 0; i--) {
if (divisor.mant[i] > remainder[i]) { if (divisor.mant[i] > remainder[i]) {
trialgood = true; trialgood = true;
break;
} }
if (divisor.mant[i] < remainder[i]) { if (divisor.mant[i] < remainder[i]) {
break; break;

View File

@ -190,6 +190,7 @@ public abstract class BaseMultiStartMultivariateOptimizer<PAIR>
if ((min != null && s[k] < min[k]) || (max != null && s[k] > max[k])) { if ((min != null && s[k] < min[k]) || (max != null && s[k] > max[k])) {
// reject the vector // reject the vector
s = null; s = null;
break;
} }
} }
} }

View File

@ -300,10 +300,11 @@ public class SimpleRegression implements Serializable, UpdatingMultipleLinearReg
(x == null) ? 0 : x.length, (x == null) ? 0 : x.length,
(y == null) ? 0 : y.length); (y == null) ? 0 : y.length);
} }
boolean obsOk=true; boolean obsOk = true;
for( int i = 0 ; i < x.length; i++){ for( int i = 0 ; i < x.length; i++){
if( x[i] == null || x[i].length == 0 ){ if( x[i] == null || x[i].length == 0 ){
obsOk = false; obsOk = false;
break;
} }
} }
if( !obsOk ){ if( !obsOk ){