removed unnecessary parentheses
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@811833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f8254ebbd3
commit
5a63bb398c
|
@ -119,13 +119,15 @@
|
|||
<!-- Use a consistent way to put declarations -->
|
||||
<module name="DeclarationOrder" />
|
||||
|
||||
<!-- Don't add up parentheses when they are not required -->
|
||||
<module name="UnnecessaryParentheses" />
|
||||
|
||||
<!--
|
||||
<module name="IllegalCatch" />
|
||||
<module name="StringLiteralEquality" />
|
||||
<module name="MultipleStringLiterals" />
|
||||
<module name="MultipleVariableDeclarations" />
|
||||
<module name="TodoComment" />
|
||||
<module name="UnnecessaryParentheses" />
|
||||
-->
|
||||
</module>
|
||||
|
||||
|
|
|
@ -234,16 +234,11 @@ public class LoessInterpolator
|
|||
double sumX = 0, sumXSquared = 0, sumY = 0, sumXY = 0;
|
||||
double denom = Math.abs(1.0 / (xval[edge] - x));
|
||||
for (int k = ileft; k <= iright; ++k) {
|
||||
final double xk = xval[k];
|
||||
final double yk = yval[k];
|
||||
double dist;
|
||||
if (k < i) {
|
||||
dist = (x - xk);
|
||||
} else {
|
||||
dist = (xk - x);
|
||||
}
|
||||
final double w = tricube(dist * denom) * robustnessWeights[k];
|
||||
final double xkw = xk * w;
|
||||
final double xk = xval[k];
|
||||
final double yk = yval[k];
|
||||
final double dist = (k < i) ? x - xk : xk - x;
|
||||
final double w = tricube(dist * denom) * robustnessWeights[k];
|
||||
final double xkw = xk * w;
|
||||
sumWeights += w;
|
||||
sumX += xkw;
|
||||
sumXSquared += xk * xkw;
|
||||
|
|
|
@ -234,7 +234,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateRealFunction {
|
|||
for (j = i; j > 0; j--) {
|
||||
c[j] = c[j-1] - c[j] * x[i];
|
||||
}
|
||||
c[0] *= (-x[i]);
|
||||
c[0] *= -x[i];
|
||||
c[i+1] = 1;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateRealFunction {
|
|||
d = 1;
|
||||
for (j = 0; j < n; j++) {
|
||||
if (i != j) {
|
||||
d *= (x[i] - x[j]);
|
||||
d *= x[i] - x[j];
|
||||
}
|
||||
}
|
||||
if (d == 0.0) {
|
||||
|
|
|
@ -239,7 +239,7 @@ public class BrentSolver extends UnivariateRealSolverImpl {
|
|||
setResult(x1, i);
|
||||
return result;
|
||||
}
|
||||
double dx = (x2 - x1);
|
||||
double dx = x2 - x1;
|
||||
double tolerance =
|
||||
Math.max(relativeAccuracy * Math.abs(x1), absoluteAccuracy);
|
||||
if (Math.abs(dx) <= tolerance) {
|
||||
|
|
|
@ -117,9 +117,15 @@ public class LaguerreSolver extends UnivariateRealSolverImpl {
|
|||
throws ConvergenceException, FunctionEvaluationException {
|
||||
|
||||
// check for zeros before verifying bracketing
|
||||
if (f.value(min) == 0.0) { return min; }
|
||||
if (f.value(max) == 0.0) { return max; }
|
||||
if (f.value(initial) == 0.0) { return initial; }
|
||||
if (f.value(min) == 0.0) {
|
||||
return min;
|
||||
}
|
||||
if (f.value(max) == 0.0) {
|
||||
return max;
|
||||
}
|
||||
if (f.value(initial) == 0.0) {
|
||||
return initial;
|
||||
}
|
||||
|
||||
verifyBracketing(min, max, f);
|
||||
verifySequence(min, initial, max);
|
||||
|
@ -299,8 +305,8 @@ public class LaguerreSolver extends UnivariateRealSolverImpl {
|
|||
throw MathRuntimeException.createIllegalArgumentException(
|
||||
"polynomial degree must be positive: degree={0}", n);
|
||||
}
|
||||
Complex N = new Complex(n, 0.0);
|
||||
Complex N1 = new Complex((n-1), 0.0);
|
||||
Complex N = new Complex(n, 0.0);
|
||||
Complex N1 = new Complex(n - 1, 0.0);
|
||||
|
||||
int i = 1;
|
||||
Complex pv = null;
|
||||
|
|
|
@ -181,7 +181,7 @@ public abstract class UnivariateRealSolverImpl
|
|||
throws FunctionEvaluationException {
|
||||
final double f1 = function.value(lower);
|
||||
final double f2 = function.value(upper);
|
||||
return ((f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0));
|
||||
return (f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,13 +117,13 @@ public class Complex implements FieldElement<Complex>, Serializable {
|
|||
return Math.abs(real);
|
||||
}
|
||||
double q = real / imaginary;
|
||||
return (Math.abs(imaginary) * Math.sqrt(1 + q*q));
|
||||
return Math.abs(imaginary) * Math.sqrt(1 + q * q);
|
||||
} else {
|
||||
if (real == 0.0) {
|
||||
return Math.abs(imaginary);
|
||||
}
|
||||
double q = imaginary / real;
|
||||
return (Math.abs(real) * Math.sqrt(1 + q*q));
|
||||
return Math.abs(real) * Math.sqrt(1 + q * q);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isSquare() {
|
||||
return (getColumnDimension() == getRowDimension());
|
||||
return getColumnDimension() == getRowDimension();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -636,7 +636,7 @@ public abstract class AbstractRealMatrix implements RealMatrix {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
public boolean isSquare() {
|
||||
return (getColumnDimension() == getRowDimension());
|
||||
return getColumnDimension() == getRowDimension();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -948,7 +948,7 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
|
|||
return ZERO;
|
||||
} else {
|
||||
BigDecimal det = (parity == 1) ? ONE : ONE.negate();
|
||||
for (int i = 0; i < this.getRowDimension(); i++) {
|
||||
for (int i = 0; i < getRowDimension(); i++) {
|
||||
det = det.multiply(lu[i][i]);
|
||||
}
|
||||
return det;
|
||||
|
@ -960,7 +960,7 @@ public class BigMatrixImpl implements BigMatrix, Serializable {
|
|||
* @return true if the matrix is square (rowDimension = columnDimension)
|
||||
*/
|
||||
public boolean isSquare() {
|
||||
return (this.getColumnDimension() == this.getRowDimension());
|
||||
return getColumnDimension() == getRowDimension();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -149,7 +149,7 @@ public class EventState {
|
|||
throws EventException {
|
||||
t0 = tStart;
|
||||
g0 = handler.g(tStart, yStart);
|
||||
g0Positive = (g0 >= 0);
|
||||
g0Positive = g0 >= 0;
|
||||
}
|
||||
|
||||
/** Evaluate the impact of the proposed step on the event handler.
|
||||
|
@ -188,7 +188,7 @@ public class EventState {
|
|||
// there is a sign change: an event is expected during this step
|
||||
|
||||
// variation direction, with respect to the integration direction
|
||||
increasing = (gb >= ga);
|
||||
increasing = gb >= ga;
|
||||
|
||||
final UnivariateRealFunction f = new UnivariateRealFunction() {
|
||||
public double value(final double t) throws FunctionEvaluationException {
|
||||
|
@ -288,7 +288,7 @@ public class EventState {
|
|||
g0Positive = increasing;
|
||||
nextAction = handler.eventOccurred(t, y, !(increasing ^ forward));
|
||||
} else {
|
||||
g0Positive = (g0 >= 0);
|
||||
g0Positive = g0 >= 0;
|
||||
nextAction = EventHandler.CONTINUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class AdamsBashforthIntegrator extends AdamsIntegrator {
|
|||
sanityChecks(equations, t0, y0, t, y);
|
||||
setEquations(equations);
|
||||
resetEvaluations();
|
||||
final boolean forward = (t > t0);
|
||||
final boolean forward = t > t0;
|
||||
|
||||
// initialize working arrays
|
||||
if (y != y0) {
|
||||
|
|
|
@ -209,7 +209,7 @@ public class AdamsMoultonIntegrator extends AdamsIntegrator {
|
|||
sanityChecks(equations, t0, y0, t, y);
|
||||
setEquations(equations);
|
||||
resetEvaluations();
|
||||
final boolean forward = (t > t0);
|
||||
final boolean forward = t > t0;
|
||||
|
||||
// initialize working arrays
|
||||
if (y != y0) {
|
||||
|
|
|
@ -199,7 +199,7 @@ public abstract class EmbeddedRungeKuttaIntegrator
|
|||
sanityChecks(equations, t0, y0, t, y);
|
||||
setEquations(equations);
|
||||
resetEvaluations();
|
||||
final boolean forward = (t > t0);
|
||||
final boolean forward = t > t0;
|
||||
|
||||
// create some internal working arrays
|
||||
final int stages = c.length + 1;
|
||||
|
|
|
@ -560,7 +560,7 @@ public class GraggBulirschStoerIntegrator extends AdaptiveStepsizeIntegrator {
|
|||
sanityChecks(equations, t0, y0, t, y);
|
||||
setEquations(equations);
|
||||
resetEvaluations();
|
||||
final boolean forward = (t > t0);
|
||||
final boolean forward = t > t0;
|
||||
|
||||
// create some internal working arrays
|
||||
final double[] yDot0 = new double[y0.length];
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class RungeKuttaIntegrator extends AbstractIntegrator {
|
|||
sanityChecks(equations, t0, y0, t, y);
|
||||
setEquations(equations);
|
||||
resetEvaluations();
|
||||
final boolean forward = (t > t0);
|
||||
final boolean forward = t > t0;
|
||||
|
||||
// create some internal working arrays
|
||||
final int stages = c.length + 1;
|
||||
|
|
|
@ -122,7 +122,7 @@ public class StepNormalizer implements StepHandler {
|
|||
lastDerivatives = interpolator.getInterpolatedDerivatives().clone();
|
||||
|
||||
// take the integration direction into account
|
||||
forward = (interpolator.getCurrentTime() >= lastTime);
|
||||
forward = interpolator.getCurrentTime() >= lastTime;
|
||||
if (! forward) {
|
||||
h = -h;
|
||||
}
|
||||
|
|
|
@ -241,10 +241,10 @@ public class MersenneTwister extends BitsStreamGenerator implements Serializable
|
|||
y = mt[mti++];
|
||||
|
||||
// tempering
|
||||
y ^= (y >>> 11);
|
||||
y ^= y >>> 11;
|
||||
y ^= (y << 7) & 0x9d2c5680;
|
||||
y ^= (y << 15) & 0xefc60000;
|
||||
y ^= (y >>> 18);
|
||||
y ^= y >>> 18;
|
||||
|
||||
return y >>> (32 - bits);
|
||||
|
||||
|
|
|
@ -430,9 +430,8 @@ public class RandomDataImpl implements RandomData, Serializable {
|
|||
x = Math.ceil(y);
|
||||
w = -delta / mu2delta * (1.0 + y / 2.0) - e - x * logMeanMu;
|
||||
}
|
||||
accept = (w <= x * Math.log(mu) -
|
||||
MathUtils.factorialLog((int) (mu + x)) /
|
||||
muFactorialLog);
|
||||
accept = w <= x * Math.log(mu) -
|
||||
MathUtils.factorialLog((int) (mu + x)) / muFactorialLog;
|
||||
}
|
||||
// cast to long is acceptable because both x and mu are whole
|
||||
// numbers.
|
||||
|
|
|
@ -557,7 +557,7 @@ public class Frequency implements Serializable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public int compare(Comparable<T> o1, Comparable<T> o2) {
|
||||
return (o1.compareTo((T) o2));
|
||||
return o1.compareTo((T) o2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,8 @@ public abstract class AbstractStorelessUnivariateStatistic
|
|||
return false;
|
||||
}
|
||||
AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object;
|
||||
return (MathUtils.equals(stat.getResult(), this.getResult()) &&
|
||||
MathUtils.equals(stat.getN(), this.getN()));
|
||||
return MathUtils.equals(stat.getResult(), this.getResult()) &&
|
||||
MathUtils.equals(stat.getN(), this.getN());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,8 +93,8 @@ public class AggregateSummaryStatistics implements StatisticalSummary,
|
|||
* @see #createContributingStatistics()
|
||||
*/
|
||||
public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics) {
|
||||
this(prototypeStatistics, (prototypeStatistics == null ? null :
|
||||
new SummaryStatistics(prototypeStatistics)));
|
||||
this(prototypeStatistics,
|
||||
prototypeStatistics == null ? null : new SummaryStatistics(prototypeStatistics));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,11 +118,11 @@ public class AggregateSummaryStatistics implements StatisticalSummary,
|
|||
* @see #createContributingStatistics()
|
||||
*/
|
||||
public AggregateSummaryStatistics(SummaryStatistics prototypeStatistics,
|
||||
SummaryStatistics initialStatistics) {
|
||||
this.statisticsPrototype = ((prototypeStatistics == null) ?
|
||||
new SummaryStatistics() : prototypeStatistics);
|
||||
this.statistics = ((initialStatistics == null) ?
|
||||
new SummaryStatistics() : initialStatistics);
|
||||
SummaryStatistics initialStatistics) {
|
||||
this.statisticsPrototype =
|
||||
(prototypeStatistics == null) ? new SummaryStatistics() : prototypeStatistics;
|
||||
this.statistics =
|
||||
(initialStatistics == null) ? new SummaryStatistics() : initialStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,8 +400,8 @@ public class AggregateSummaryStatistics implements StatisticalSummary,
|
|||
return false;
|
||||
}
|
||||
AggregatingSummaryStatistics stat = (AggregatingSummaryStatistics)object;
|
||||
return (super.equals(stat) &&
|
||||
aggregateStatistics.equals(stat.aggregateStatistics));
|
||||
return super.equals(stat) &&
|
||||
aggregateStatistics.equals(stat.aggregateStatistics);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -208,7 +208,7 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
|
|||
stdDev = 0.0;
|
||||
}
|
||||
}
|
||||
return (stdDev);
|
||||
return stdDev;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -369,16 +369,15 @@ public class MultivariateSummaryStatistics
|
|||
return false;
|
||||
}
|
||||
MultivariateSummaryStatistics stat = (MultivariateSummaryStatistics) object;
|
||||
return (MathUtils.equals(stat.getGeometricMean(),
|
||||
this.getGeometricMean()) &&
|
||||
MathUtils.equals(stat.getMax(), this.getMax()) &&
|
||||
MathUtils.equals(stat.getMean(),this.getMean()) &&
|
||||
MathUtils.equals(stat.getMin(),this.getMin()) &&
|
||||
MathUtils.equals(stat.getN(), this.getN()) &&
|
||||
MathUtils.equals(stat.getSum(), this.getSum()) &&
|
||||
MathUtils.equals(stat.getSumSq(),this.getSumSq()) &&
|
||||
MathUtils.equals(stat.getSumLog(),this.getSumLog()) &&
|
||||
stat.getCovariance().equals(this.getCovariance()));
|
||||
return MathUtils.equals(stat.getGeometricMean(), getGeometricMean()) &&
|
||||
MathUtils.equals(stat.getMax(), getMax()) &&
|
||||
MathUtils.equals(stat.getMean(), getMean()) &&
|
||||
MathUtils.equals(stat.getMin(), getMin()) &&
|
||||
MathUtils.equals(stat.getN(), getN()) &&
|
||||
MathUtils.equals(stat.getSum(), getSum()) &&
|
||||
MathUtils.equals(stat.getSumSq(), getSumSq()) &&
|
||||
MathUtils.equals(stat.getSumLog(), getSumLog()) &&
|
||||
stat.getCovariance().equals( getCovariance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -135,12 +135,12 @@ public class StatisticalSummaryValues implements Serializable,
|
|||
return false;
|
||||
}
|
||||
StatisticalSummaryValues stat = (StatisticalSummaryValues) object;
|
||||
return (MathUtils.equals(stat.getMax(), this.getMax()) &&
|
||||
MathUtils.equals(stat.getMean(),this.getMean()) &&
|
||||
MathUtils.equals(stat.getMin(),this.getMin()) &&
|
||||
MathUtils.equals(stat.getN(), this.getN()) &&
|
||||
MathUtils.equals(stat.getSum(), this.getSum()) &&
|
||||
MathUtils.equals(stat.getVariance(),this.getVariance()));
|
||||
return MathUtils.equals(stat.getMax(), getMax()) &&
|
||||
MathUtils.equals(stat.getMean(), getMean()) &&
|
||||
MathUtils.equals(stat.getMin(), getMin()) &&
|
||||
MathUtils.equals(stat.getN(), getN()) &&
|
||||
MathUtils.equals(stat.getSum(), getSum()) &&
|
||||
MathUtils.equals(stat.getVariance(), getVariance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -221,7 +221,7 @@ public class SummaryStatistics implements StatisticalSummary, Serializable {
|
|||
stdDev = 0.0;
|
||||
}
|
||||
}
|
||||
return (stdDev);
|
||||
return stdDev;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,15 +360,14 @@ public class SummaryStatistics implements StatisticalSummary, Serializable {
|
|||
return false;
|
||||
}
|
||||
SummaryStatistics stat = (SummaryStatistics)object;
|
||||
return (MathUtils.equals(stat.getGeometricMean(), this.getGeometricMean()) &&
|
||||
MathUtils.equals(stat.getMax(), this.getMax()) &&
|
||||
MathUtils.equals(stat.getMean(), this.getMean()) &&
|
||||
MathUtils.equals(stat.getMin(), this.getMin()) &&
|
||||
MathUtils.equals(stat.getN(), this.getN()) &&
|
||||
MathUtils.equals(stat.getSum(), this.getSum()) &&
|
||||
MathUtils.equals(stat.getSumsq(), this.getSumsq()) &&
|
||||
MathUtils.equals(stat.getVariance(),
|
||||
this.getVariance()));
|
||||
return MathUtils.equals(stat.getGeometricMean(), getGeometricMean()) &&
|
||||
MathUtils.equals(stat.getMax(), getMax()) &&
|
||||
MathUtils.equals(stat.getMean(), getMean()) &&
|
||||
MathUtils.equals(stat.getMin(), getMin()) &&
|
||||
MathUtils.equals(stat.getN(), getN()) &&
|
||||
MathUtils.equals(stat.getSum(), getSum()) &&
|
||||
MathUtils.equals(stat.getSumsq(), getSumsq()) &&
|
||||
MathUtils.equals(stat.getVariance(), getVariance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,7 +175,7 @@ public class Kurtosis extends AbstractStorelessUnivariateStatistic implements S
|
|||
// standard deviation
|
||||
double accum3 = 0.0;
|
||||
for (int i = begin; i < begin + length; i++) {
|
||||
accum3 += Math.pow((values[i] - mean), 4.0);
|
||||
accum3 += Math.pow(values[i] - mean, 4.0);
|
||||
}
|
||||
accum3 /= Math.pow(stdDev, 4.0d);
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class Kurtosis extends AbstractStorelessUnivariateStatistic implements S
|
|||
double coefficientOne =
|
||||
(n0 * (n0 + 1)) / ((n0 - 1) * (n0 - 2) * (n0 - 3));
|
||||
double termTwo =
|
||||
((3 * Math.pow(n0 - 1, 2.0)) / ((n0 - 2) * (n0 - 3)));
|
||||
(3 * Math.pow(n0 - 1, 2.0)) / ((n0 - 2) * (n0 - 3));
|
||||
|
||||
// Calculate kurtosis
|
||||
kurt = (coefficientOne * accum3) - termTwo;
|
||||
|
|
|
@ -161,7 +161,7 @@ public class Mean extends AbstractStorelessUnivariateStatistic
|
|||
// Compute correction factor in second pass
|
||||
double correction = 0;
|
||||
for (int i = begin; i < begin + length; i++) {
|
||||
correction += (values[i] - xbar);
|
||||
correction += values[i] - xbar;
|
||||
}
|
||||
return xbar + (correction/sampleSize);
|
||||
}
|
||||
|
|
|
@ -164,17 +164,18 @@ public class Skewness extends AbstractStorelessUnivariateStatistic implements Se
|
|||
double accum = 0.0;
|
||||
double accum2 = 0.0;
|
||||
for (int i = begin; i < begin + length; i++) {
|
||||
accum += Math.pow((values[i] - m), 2.0);
|
||||
accum2 += (values[i] - m);
|
||||
final double d = values[i] - m;
|
||||
accum += d * d;
|
||||
accum2 += d;
|
||||
}
|
||||
double stdDev = Math.sqrt((accum - (Math.pow(accum2, 2) / length)) /
|
||||
(length - 1));
|
||||
final double variance = (accum - (accum2 * accum2 / length)) / (length - 1);
|
||||
|
||||
double accum3 = 0.0;
|
||||
for (int i = begin; i < begin + length; i++) {
|
||||
accum3 += Math.pow(values[i] - m, 3.0d);
|
||||
final double d = values[i] - m;
|
||||
accum3 += d * d * d;
|
||||
}
|
||||
accum3 /= Math.pow(stdDev, 3.0d);
|
||||
accum3 /= variance * Math.sqrt(variance);
|
||||
|
||||
// Get N
|
||||
double n0 = length;
|
||||
|
|
|
@ -159,7 +159,7 @@ public class Sum extends AbstractStorelessUnivariateStatistic implements Seriali
|
|||
if (test(values, weights, begin, length)) {
|
||||
sum = 0.0;
|
||||
for (int i = begin; i < begin + length; i++) {
|
||||
sum += (values[i] * weights[i]);
|
||||
sum += values[i] * weights[i];
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
|
|
|
@ -87,13 +87,12 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
rescale = true;
|
||||
}
|
||||
double sumSq = 0.0d;
|
||||
double dev = 0.0d;
|
||||
for (int i = 0; i < observed.length; i++) {
|
||||
if (rescale) {
|
||||
dev = (observed[i] - ratio * expected[i]);
|
||||
final double dev = observed[i] - ratio * expected[i];
|
||||
sumSq += dev * dev / (ratio * expected[i]);
|
||||
} else {
|
||||
dev = (observed[i] - expected[i]);
|
||||
final double dev = observed[i] - expected[i];
|
||||
sumSq += dev * dev / expected[i];
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +139,7 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
"out of bounds significance level {0}, must be between {1} and {2}",
|
||||
alpha, 0, 0.5);
|
||||
}
|
||||
return (chiSquareTest(expected, observed) < alpha);
|
||||
return chiSquareTest(expected, observed) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +207,7 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
"out of bounds significance level {0}, must be between {1} and {2}",
|
||||
alpha, 0.0, 0.5);
|
||||
}
|
||||
return (chiSquareTest(counts) < alpha);
|
||||
return chiSquareTest(counts) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +255,7 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
"observed counts are all 0 in second observed array");
|
||||
}
|
||||
// Compare and compute weight only if different
|
||||
unequalCounts = (countSum1 != countSum2);
|
||||
unequalCounts = countSum1 != countSum2;
|
||||
if (unequalCounts) {
|
||||
weight = Math.sqrt((double) countSum1 / (double) countSum2);
|
||||
}
|
||||
|
@ -315,7 +314,7 @@ public class ChiSquareTestImpl implements UnknownDistributionChiSquareTest {
|
|||
"out of bounds significance level {0}, must be between {1} and {2}",
|
||||
alpha, 0.0, 0.5);
|
||||
}
|
||||
return (chiSquareTestDataSetsComparison(observed1, observed2) < alpha);
|
||||
return chiSquareTestDataSetsComparison(observed1, observed2) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,7 +105,7 @@ public class OneWayAnovaImpl implements OneWayAnova {
|
|||
"out of bounds significance level {0}, must be between {1} and {2}",
|
||||
alpha, 0, 0.5);
|
||||
}
|
||||
return (anovaPValue(categoryData) < alpha);
|
||||
return anovaPValue(categoryData) < alpha;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class TTestImpl implements TTest {
|
|||
public boolean pairedTTest(double[] sample1, double[] sample2, double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (pairedTTest(sample1, sample2) < alpha);
|
||||
return pairedTTest(sample1, sample2) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -444,7 +444,7 @@ public class TTestImpl implements TTest {
|
|||
public boolean tTest(double mu, double[] sample, double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (tTest(mu, sample) < alpha);
|
||||
return tTest(mu, sample) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,7 +522,7 @@ public class TTestImpl implements TTest {
|
|||
double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (tTest(mu, sampleStats) < alpha);
|
||||
return tTest(mu, sampleStats) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -669,7 +669,7 @@ public class TTestImpl implements TTest {
|
|||
double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (tTest(sample1, sample2) < alpha);
|
||||
return tTest(sample1, sample2) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -727,7 +727,7 @@ public class TTestImpl implements TTest {
|
|||
double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (homoscedasticTTest(sample1, sample2) < alpha);
|
||||
return homoscedasticTTest(sample1, sample2) < alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -874,7 +874,7 @@ public class TTestImpl implements TTest {
|
|||
StatisticalSummary sampleStats2, double alpha)
|
||||
throws IllegalArgumentException, MathException {
|
||||
checkSignificanceLevel(alpha);
|
||||
return (tTest(sampleStats1, sampleStats2) < alpha);
|
||||
return tTest(sampleStats1, sampleStats2) < alpha;
|
||||
}
|
||||
|
||||
//----------------------------------------------- Protected methods
|
||||
|
|
|
@ -840,7 +840,7 @@ public class FastFourierTransformer implements Serializable {
|
|||
"cannot compute 0-th root of unity, indefinite result");
|
||||
}
|
||||
|
||||
isForward = (n > 0);
|
||||
isForward = n > 0;
|
||||
|
||||
// avoid repetitive calculations
|
||||
final int absN = Math.abs(n);
|
||||
|
@ -914,8 +914,7 @@ public class FastFourierTransformer implements Serializable {
|
|||
k, 0, omegaCount - 1);
|
||||
}
|
||||
|
||||
return (isForward) ?
|
||||
omegaImaginaryForward[k] : omegaImaginaryInverse[k];
|
||||
return isForward ? omegaImaginaryForward[k] : omegaImaginaryInverse[k];
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ public final class MathUtils {
|
|||
// unnecessary.
|
||||
for (int j = 1, i = n - k + 1; j <= k; i++, j++) {
|
||||
long d = gcd(i, j);
|
||||
result = mulAndCheck((result / (j / d)), (i / d));
|
||||
result = mulAndCheck(result / (j / d), i / d);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -402,7 +402,7 @@ public final class MathUtils {
|
|||
* @return true if the values are equal or both are NaN
|
||||
*/
|
||||
public static boolean equals(double x, double y) {
|
||||
return ((Double.isNaN(x) && Double.isNaN(y)) || x == y);
|
||||
return (Double.isNaN(x) && Double.isNaN(y)) || x == y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -614,7 +614,7 @@ public final class MathUtils {
|
|||
"overflow: gcd({0}, {1}) is 2^31",
|
||||
p, q);
|
||||
}
|
||||
return (Math.abs(u) + Math.abs(v));
|
||||
return Math.abs(u) + Math.abs(v);
|
||||
}
|
||||
// keep u and v negative, as negative integers range down to
|
||||
// -2^31, while positive numbers can only be as large as 2^31-1
|
||||
|
|
|
@ -594,7 +594,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
|
|||
* @return the length of the internal storage array.
|
||||
*/
|
||||
synchronized int getInternalLength() {
|
||||
return (internalArray.length);
|
||||
return internalArray.length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -604,7 +604,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
|
|||
* @return number of elements
|
||||
*/
|
||||
public synchronized int getNumElements() {
|
||||
return (numElements);
|
||||
return numElements;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -621,7 +621,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
|
|||
*/
|
||||
@Deprecated
|
||||
public synchronized double[] getValues() {
|
||||
return (internalArray);
|
||||
return internalArray;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -637,7 +637,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
|
|||
* @since 2.0
|
||||
*/
|
||||
public synchronized double[] getInternalValues() {
|
||||
return (internalArray);
|
||||
return internalArray;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue