Author: sebb
Date: Sun Apr 5 16:48:53 2009
New Revision: 762116
URL: http://svn.apache.org/viewvc?rev=762116&view=rev
Log:
Remove unnecessary casts
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/SimpleEstimationProblem.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java
commons/proper/math/trunk/src/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/StatUtils.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/TTestImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
Sun Apr 5 16:48:53 2009
@@ -39,7 +39,7 @@
*/
@Override
public Object[][] getContents() {
- return (Object[][]) contents.clone();
+ return contents.clone();
}
/** Non-translated/translated messages arrays. */
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
Sun Apr 5 16:48:53 2009
@@ -234,7 +234,7 @@
}
double[] result = new double[n - 1];
for (int i = n - 1; i > 0; i--) {
- result[i - 1] = (double) i * coefficients[i];
+ result[i - 1] = i * coefficients[i];
}
return result;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
Sun Apr 5 16:48:53 2009
@@ -303,8 +303,8 @@
throw new IllegalArgumentException
("Polynomial degree must be positive: degree=" + n);
}
- Complex N = new Complex((double)n, 0.0);
- Complex N1 = new Complex((double)(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;
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/SimpleEstimationProblem.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/SimpleEstimationProblem.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/SimpleEstimationProblem.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/SimpleEstimationProblem.java
Sun Apr 5 16:48:53 2009
@@ -57,7 +57,7 @@
* @return parameters
*/
public EstimatedParameter[] getAllParameters() {
- return (EstimatedParameter[]) parameters.toArray(new
EstimatedParameter[parameters.size()]);
+ return parameters.toArray(new EstimatedParameter[parameters.size()]);
}
/**
@@ -75,7 +75,7 @@
}
// convert to an array
- return (EstimatedParameter[]) unbound.toArray(new
EstimatedParameter[unbound.size()]);
+ return unbound.toArray(new EstimatedParameter[unbound.size()]);
}
@@ -84,7 +84,7 @@
* @return measurements
*/
public WeightedMeasurement[] getMeasurements() {
- return (WeightedMeasurement[]) measurements.toArray(new
WeightedMeasurement[measurements.size()]);
+ return measurements.toArray(new
WeightedMeasurement[measurements.size()]);
}
/** Add a parameter to the problem.
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
Sun Apr 5 16:48:53 2009
@@ -122,7 +122,7 @@
throw new IllegalArgumentException("propagation direction mismatch");
}
- final StepInterpolator lastInterpolator = (StepInterpolator)
steps.get(index);
+ final StepInterpolator lastInterpolator = steps.get(index);
final double current = lastInterpolator.getCurrentTime();
final double previous = lastInterpolator.getPreviousTime();
final double step = current - previous;
@@ -138,7 +138,7 @@
}
index = steps.size() - 1;
- finalTime = ((StepInterpolator) steps.get(index)).getCurrentTime();
+ finalTime = (steps.get(index)).getCurrentTime();
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolator.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolator.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolator.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolator.java
Sun Apr 5 16:48:53 2009
@@ -71,10 +71,10 @@
} else {
- v1 = (double[]) interpolator.v1.clone();
- v2 = (double[]) interpolator.v2.clone();
- v3 = (double[]) interpolator.v3.clone();
- v4 = (double[]) interpolator.v4.clone();
+ v1 = interpolator.v1.clone();
+ v2 = interpolator.v2.clone();
+ v3 = interpolator.v3.clone();
+ v4 = interpolator.v4.clone();
vectorsInitialized = interpolator.vectorsInitialized;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/AbstractStepInterpolator.java
Sun Apr 5 16:48:53 2009
@@ -142,9 +142,9 @@
interpolatedTime = interpolator.interpolatedTime;
if (interpolator.currentState != null) {
- currentState = (double[]) interpolator.currentState.clone();
- interpolatedState = (double[])
interpolator.interpolatedState.clone();
- interpolatedDerivatives = (double[])
interpolator.interpolatedDerivatives.clone();
+ currentState = interpolator.currentState.clone();
+ interpolatedState = interpolator.interpolatedState.clone();
+ interpolatedDerivatives = interpolator.interpolatedDerivatives.clone();
} else {
currentState = null;
interpolatedState = null;
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizer.java
Sun Apr 5 16:48:53 2009
@@ -119,7 +119,7 @@
if (optima == null) {
throw MathRuntimeException.createIllegalStateException("no optimum
computed yet");
}
- return (RealPointValuePair[]) optima.clone();
+ return optima.clone();
}
/** {...@inheritdoc} */
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizer.java
Sun Apr 5 16:48:53 2009
@@ -120,7 +120,7 @@
if (optima == null) {
throw MathRuntimeException.createIllegalStateException("no optimum
computed yet");
}
- return (VectorialPointValuePair[]) optima.clone();
+ return optima.clone();
}
/** {...@inheritdoc} */
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizer.java
Sun Apr 5 16:48:53 2009
@@ -113,7 +113,7 @@
if (optima == null) {
throw MathRuntimeException.createIllegalStateException("no optimum
computed yet");
}
- return (RealPointValuePair[]) optima.clone();
+ return optima.clone();
}
/** {...@inheritdoc} */
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/random/CorrelatedRandomVectorGenerator.java
Sun Apr 5 16:48:53 2009
@@ -90,7 +90,7 @@
if (mean.length != order) {
throw new DimensionMismatchException(mean.length, order);
}
- this.mean = (double[]) mean.clone();
+ this.mean = mean.clone();
decompose(covariance, small);
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
Sun Apr 5 16:48:53 2009
@@ -48,8 +48,8 @@
if (mean.length != standardDeviation.length) {
throw new IllegalArgumentException("dimension mismatch");
}
- this.mean = (double[]) mean.clone();
- this.standardDeviation = (double[]) standardDeviation.clone();
+ this.mean = mean.clone();
+ this.standardDeviation = standardDeviation.clone();
this.generator = generator;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/StatUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/StatUtils.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/StatUtils.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/StatUtils.java
Sun Apr 5 16:48:53 2009
@@ -586,7 +586,7 @@
*/
public static double meanDifference(final double[] sample1, final double[]
sample2)
throws IllegalArgumentException {
- return sumDifference(sample1, sample2) / (double) sample1.length;
+ return sumDifference(sample1, sample2) / sample1.length;
}
/**
@@ -615,7 +615,7 @@
sum1 += (diff - meanDifference) *(diff - meanDifference);
sum2 += diff - meanDifference;
}
- return (sum1 - (sum2 * sum2 / (double) n)) / (double) (n - 1);
+ return (sum1 - (sum2 * sum2 / n)) / (n - 1);
}
}
\ No newline at end of file
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java
Sun Apr 5 16:48:53 2009
@@ -425,7 +425,7 @@
* @return the StorelessUnivariateStatistic implementing the sum
*/
public StorelessUnivariateStatistic[] getSumImpl() {
- return (StorelessUnivariateStatistic[]) sumImpl.clone();
+ return sumImpl.clone();
}
/**
@@ -452,7 +452,7 @@
* @return the StorelessUnivariateStatistic implementing the sum of squares
*/
public StorelessUnivariateStatistic[] getSumsqImpl() {
- return (StorelessUnivariateStatistic[]) sumSqImpl.clone();
+ return sumSqImpl.clone();
}
/**
@@ -479,7 +479,7 @@
* @return the StorelessUnivariateStatistic implementing the minimum
*/
public StorelessUnivariateStatistic[] getMinImpl() {
- return (StorelessUnivariateStatistic[]) minImpl.clone();
+ return minImpl.clone();
}
/**
@@ -506,7 +506,7 @@
* @return the StorelessUnivariateStatistic implementing the maximum
*/
public StorelessUnivariateStatistic[] getMaxImpl() {
- return (StorelessUnivariateStatistic[]) maxImpl.clone();
+ return maxImpl.clone();
}
/**
@@ -533,7 +533,7 @@
* @return the StorelessUnivariateStatistic implementing the log sum
*/
public StorelessUnivariateStatistic[] getSumLogImpl() {
- return (StorelessUnivariateStatistic[]) sumLogImpl.clone();
+ return sumLogImpl.clone();
}
/**
@@ -560,7 +560,7 @@
* @return the StorelessUnivariateStatistic implementing the geometric mean
*/
public StorelessUnivariateStatistic[] getGeoMeanImpl() {
- return (StorelessUnivariateStatistic[]) geoMeanImpl.clone();
+ return geoMeanImpl.clone();
}
/**
@@ -587,7 +587,7 @@
* @return the StorelessUnivariateStatistic implementing the mean
*/
public StorelessUnivariateStatistic[] getMeanImpl() {
- return (StorelessUnivariateStatistic[]) meanImpl.clone();
+ return meanImpl.clone();
}
/**
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
Sun Apr 5 16:48:53 2009
@@ -99,7 +99,7 @@
m1 = 0.0;
}
n++;
- double n0 = (double) n;
+ double n0 = n;
dev = d - m1;
nDev = dev / n0;
m1 += nDev;
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
Sun Apr 5 16:48:53 2009
@@ -94,7 +94,7 @@
super.increment(d);
- double n0 = (double) n;
+ double n0 = n;
m4 = m4 - 4.0 * nDev * prevM3 + 6.0 * nDevSq * prevM2 +
((n0 * n0) - 3 * (n0 -1)) * (nDevSq * nDevSq * (n0 - 1) * n0);
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
Sun Apr 5 16:48:53 2009
@@ -103,7 +103,7 @@
@Override
public double getResult() {
if (sumOfLogs.getN() > 0) {
- return Math.exp(sumOfLogs.getResult() / (double) sumOfLogs.getN());
+ return Math.exp(sumOfLogs.getResult() / sumOfLogs.getN());
} else {
return Double.NaN;
}
@@ -137,7 +137,7 @@
public double evaluate(
final double[] values, final int begin, final int length) {
return Math.exp(
- sumOfLogs.evaluate(values, begin, length) / (double) length);
+ sumOfLogs.evaluate(values, begin, length) / length);
}
/**
@@ -182,7 +182,7 @@
* @throws NullPointerException if either source or dest is null
*/
public static void copy(GeometricMean source, GeometricMean dest) {
- dest.sumOfLogs = (SumOfLogs) source.sumOfLogs.copy();
+ dest.sumOfLogs = source.sumOfLogs.copy();
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
Sun Apr 5 16:48:53 2009
@@ -104,11 +104,11 @@
public double getResult() {
double kurtosis = Double.NaN;
if (moment.getN() > 3) {
- double variance = moment.m2 / (double) (moment.n - 1);
+ double variance = moment.m2 / (moment.n - 1);
if (moment.n <= 3 || variance < 10E-20) {
kurtosis = 0.0;
} else {
- double n = (double) moment.n;
+ double n = moment.n;
kurtosis =
(n * (n + 1) * moment.m4 -
3 * moment.m2 * moment.m2 * (n - 1)) /
@@ -210,7 +210,7 @@
* @throws NullPointerException if either source or dest is null
*/
public static void copy(Kurtosis source, Kurtosis dest) {
- dest.moment = (FourthMoment) source.moment.copy();
+ dest.moment = source.moment.copy();
dest.incMoment = source.incMoment;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
Sun Apr 5 16:48:53 2009
@@ -153,7 +153,7 @@
public double evaluate(final double[] values,final int begin, final int
length) {
if (test(values, begin, length)) {
Sum sum = new Sum();
- double sampleSize = (double) length;
+ double sampleSize = length;
// Compute initial estimate using definitional formula
double xbar = sum.evaluate(values, begin, length) / sampleSize;
@@ -189,6 +189,6 @@
*/
public static void copy(Mean source, Mean dest) {
dest.incMoment = source.incMoment;
- dest.moment = (FirstMoment) source.moment.copy();
+ dest.moment = source.moment.copy();
}
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
Sun Apr 5 16:48:53 2009
@@ -103,11 +103,11 @@
if (moment.n < 3) {
return Double.NaN;
}
- double variance = moment.m2 / (double) (moment.n - 1);
+ double variance = moment.m2 / (moment.n - 1);
if (variance < 10E-20) {
return 0.0d;
} else {
- double n0 = (double) moment.getN();
+ double n0 = moment.getN();
return (n0 * moment.m3) /
((n0 - 1) * (n0 -2) * Math.sqrt(variance) * variance);
}
@@ -167,8 +167,8 @@
accum += Math.pow((values[i] - m), 2.0);
accum2 += (values[i] - m);
}
- double stdDev = Math.sqrt((accum - (Math.pow(accum2, 2) /
((double) length))) /
- (double) (length - 1));
+ double stdDev = Math.sqrt((accum - (Math.pow(accum2, 2) /
(length))) /
+ (length - 1));
double accum3 = 0.0;
for (int i = begin; i < begin + length; i++) {
@@ -204,7 +204,7 @@
* @throws NullPointerException if either source or dest is null
*/
public static void copy(Skewness source, Skewness dest) {
- dest.moment = new ThirdMoment((ThirdMoment) source.moment.copy());
+ dest.moment = new ThirdMoment(source.moment.copy());
dest.incMoment = source.incMoment;
}
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
Sun Apr 5 16:48:53 2009
@@ -263,7 +263,7 @@
* @throws NullPointerException if either source or dest is null
*/
public static void copy(StandardDeviation source, StandardDeviation dest) {
- dest.variance = (Variance) source.variance.copy();
+ dest.variance = source.variance.copy();
}
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
Sun Apr 5 16:48:53 2009
@@ -90,7 +90,7 @@
double prevM2 = m2;
super.increment(d);
nDevSq = nDev * nDev;
- double n0 = (double) n;
+ double n0 = n;
m3 = m3 - 3.0 * nDev * prevM2 + (n0 - 1) * (n0 - 2) * nDevSq * dev;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
Sun Apr 5 16:48:53 2009
@@ -168,9 +168,9 @@
return 0d;
} else {
if (isBiasCorrected) {
- return moment.m2 / ((double) moment.n - 1d);
+ return moment.m2 / (moment.n - 1d);
} else {
- return moment.m2 / ((double) moment.n);
+ return moment.m2 / (moment.n);
}
}
}
@@ -297,7 +297,7 @@
accum += dev * dev;
accum2 += dev;
}
- double len = (double) length;
+ double len = length;
if (isBiasCorrected) {
var = (accum - (accum2 * accum2 / len)) / (len - 1.0);
} else {
@@ -371,7 +371,7 @@
* @throws NullPointerException if either source or dest is null
*/
public static void copy(Variance source, Variance dest) {
- dest.moment = (SecondMoment) source.moment.copy();
+ dest.moment = source.moment.copy();
dest.isBiasCorrected = source.isBiasCorrected;
dest.incMoment = source.incMoment;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
Sun Apr 5 16:48:53 2009
@@ -204,7 +204,7 @@
if (length == 1) {
return values[begin]; // always return single value for n = 1
}
- double n = (double) length;
+ double n = length;
double pos = p * (n + 1) / 100;
double fpos = Math.floor(pos);
int intPos = (int) fpos;
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
Sun Apr 5 16:48:53 2009
@@ -86,10 +86,10 @@
double dev = 0.0d;
for (int i = 0; i < observed.length; i++) {
if (rescale) {
- dev = ((double) observed[i] - ratio * expected[i]);
+ dev = (observed[i] - ratio * expected[i]);
sumSq += dev * dev / (ratio * expected[i]);
} else {
- dev = ((double) observed[i] - expected[i]);
+ dev = (observed[i] - expected[i]);
sumSq += dev * dev / expected[i];
}
}
@@ -155,9 +155,9 @@
double total = 0.0d;
for (int row = 0; row < nRows; row++) {
for (int col = 0; col < nCols; col++) {
- rowSum[row] += (double) counts[row][col];
- colSum[col] += (double) counts[row][col];
- total += (double) counts[row][col];
+ rowSum[row] += counts[row][col];
+ colSum[col] += counts[row][col];
+ total += counts[row][col];
}
}
@@ -167,8 +167,8 @@
for (int row = 0; row < nRows; row++) {
for (int col = 0; col < nCols; col++) {
expected = (rowSum[row] * colSum[col]) / total;
- sumSq += (((double) counts[row][col] - expected) *
- ((double) counts[row][col] - expected)) / expected;
+ sumSq += ((counts[row][col] - expected) *
+ (counts[row][col] - expected)) / expected;
}
}
return sumSq;
@@ -253,8 +253,8 @@
throw new IllegalArgumentException(
"observed counts must not both be zero");
} else {
- obs1 = (double) observed1[i];
- obs2 = (double) observed2[i];
+ obs1 = observed1[i];
+ obs2 = observed2[i];
if (unequalCounts) { // apply weights
dev = obs1/weight - obs2 * weight;
} else {
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/TTestImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/TTestImpl.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/TTestImpl.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/inference/TTestImpl.java
Sun Apr 5 16:48:53 2009
@@ -82,7 +82,7 @@
double meanDifference = StatUtils.meanDifference(sample1, sample2);
return t(meanDifference, 0,
StatUtils.varianceDifference(sample1, sample2, meanDifference),
- (double) sample1.length);
+ sample1.length);
}
/**
@@ -123,7 +123,7 @@
double meanDifference = StatUtils.meanDifference(sample1, sample2);
return tTest(meanDifference, 0,
StatUtils.varianceDifference(sample1, sample2,
meanDifference),
- (double) sample1.length);
+ sample1.length);
}
/**
@@ -256,7 +256,7 @@
}
return homoscedasticT(StatUtils.mean(sample1), StatUtils.mean(sample2),
StatUtils.variance(sample1), StatUtils.variance(sample2),
- (double) sample1.length, (double) sample2.length);
+ sample1.length, sample2.length);
}
/**
@@ -295,7 +295,7 @@
}
return t(StatUtils.mean(sample1), StatUtils.mean(sample2),
StatUtils.variance(sample1), StatUtils.variance(sample2),
- (double) sample1.length, (double) sample2.length);
+ sample1.length, sample2.length);
}
/**
@@ -339,7 +339,7 @@
}
return t(sampleStats1.getMean(), sampleStats2.getMean(),
sampleStats1.getVariance(), sampleStats2.getVariance(),
- (double) sampleStats1.getN(), (double) sampleStats2.getN());
+ sampleStats1.getN(), sampleStats2.getN());
}
/**
@@ -387,7 +387,7 @@
}
return homoscedasticT(sampleStats1.getMean(), sampleStats2.getMean(),
sampleStats1.getVariance(), sampleStats2.getVariance(),
- (double) sampleStats1.getN(), (double) sampleStats2.getN());
+ sampleStats1.getN(), sampleStats2.getN());
}
/**
@@ -594,7 +594,7 @@
}
return tTest(StatUtils.mean(sample1), StatUtils.mean(sample2),
StatUtils.variance(sample1), StatUtils.variance(sample2),
- (double) sample1.length, (double) sample2.length);
+ sample1.length, sample2.length);
}
/**
@@ -638,8 +638,8 @@
}
return homoscedasticTTest(StatUtils.mean(sample1),
StatUtils.mean(sample2), StatUtils.variance(sample1),
- StatUtils.variance(sample2), (double) sample1.length,
- (double) sample2.length);
+ StatUtils.variance(sample2), sample1.length,
+ sample2.length);
}
@@ -804,8 +804,8 @@
throw new IllegalArgumentException("insufficient data for t
statistic");
}
return tTest(sampleStats1.getMean(), sampleStats2.getMean(),
sampleStats1.getVariance(),
- sampleStats2.getVariance(), (double) sampleStats1.getN(),
- (double) sampleStats2.getN());
+ sampleStats2.getVariance(), sampleStats1.getN(),
+ sampleStats2.getN());
}
/**
@@ -850,8 +850,8 @@
}
return homoscedasticTTest(sampleStats1.getMean(),
sampleStats2.getMean(), sampleStats1.getVariance(),
- sampleStats2.getVariance(), (double) sampleStats1.getN(),
- (double) sampleStats2.getN());
+ sampleStats2.getVariance(), sampleStats1.getN(),
+ sampleStats2.getN());
}
/**
@@ -1043,7 +1043,7 @@
double v2, double n1, double n2)
throws MathException {
double t = Math.abs(homoscedasticT(m1, m2, v1, v2, n1, n2));
- double degreesOfFreedom = (double) (n1 + n2 - 2);
+ double degreesOfFreedom = (n1 + n2 - 2);
distribution.setDegreesOfFreedom(degreesOfFreedom);
return 2.0 * distribution.cumulativeProbability(-t);
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
Sun Apr 5 16:48:53 2009
@@ -124,11 +124,11 @@
} else {
double dx = x - xbar;
double dy = y - ybar;
- sumXX += dx * dx * (double) n / (double) (n + 1.0);
- sumYY += dy * dy * (double) n / (double) (n + 1.0);
- sumXY += dx * dy * (double) n / (double) (n + 1.0);
- xbar += dx / (double) (n + 1.0);
- ybar += dy / (double) (n + 1.0);
+ sumXX += dx * dx * n / (n + 1.0);
+ sumYY += dy * dy * n / (n + 1.0);
+ sumXY += dx * dy * n / (n + 1.0);
+ xbar += dx / (n + 1.0);
+ ybar += dy / (n + 1.0);
}
sumX += x;
sumY += y;
@@ -157,11 +157,11 @@
if (n > 0) {
double dx = x - xbar;
double dy = y - ybar;
- sumXX -= dx * dx * (double) n / (double) (n - 1.0);
- sumYY -= dy * dy * (double) n / (double) (n - 1.0);
- sumXY -= dx * dy * (double) n / (double) (n - 1.0);
- xbar -= dx / (double) (n - 1.0);
- ybar -= dy / (double) (n - 1.0);
+ sumXX -= dx * dx * n / (n - 1.0);
+ sumYY -= dy * dy * n / (n - 1.0);
+ sumXY -= dx * dy * n / (n - 1.0);
+ xbar -= dx / (n - 1.0);
+ ybar -= dy / (n - 1.0);
sumX -= x;
sumY -= y;
n--;
@@ -410,7 +410,7 @@
if (n < 3) {
return Double.NaN;
}
- return getSumSquaredErrors() / (double) (n - 2);
+ return getSumSquaredErrors() / (n - 2);
}
/**
@@ -468,7 +468,7 @@
*/
public double getInterceptStdErr() {
return Math.sqrt(
- getMeanSquareError() * ((1d / (double) n) + (xbar * xbar) /
sumXX));
+ getMeanSquareError() * ((1d / n) + (xbar * xbar) / sumXX));
}
/**
@@ -589,7 +589,7 @@
* @return the intercept of the regression line
*/
private double getIntercept(double slope) {
- return (sumY - slope * sumX) / ((double) n);
+ return (sumY - slope * sumX) / (n);
}
/**
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/util/MathUtils.java
Sun Apr 5 16:48:53 2009
@@ -307,7 +307,7 @@
return 0;
}
if ((k == 1) || (k == n - 1)) {
- return Math.log((double) n);
+ return Math.log(n);
}
/*
@@ -337,12 +337,12 @@
// n!/(n-k)!
for (int i = n - k + 1; i <= n; i++) {
- logSum += Math.log((double) i);
+ logSum += Math.log(i);
}
// divide by k!
for (int i = 2; i <= k; i++) {
- logSum -= Math.log((double) i);
+ logSum -= Math.log(i);
}
return logSum;
@@ -523,7 +523,7 @@
}
double logSum = 0;
for (int i = 2; i <= n; i++) {
- logSum += Math.log((double)i);
+ logSum += Math.log(i);
}
return logSum;
}
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java?rev=762116&r1=762115&r2=762116&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java
Sun Apr 5 16:48:53 2009
@@ -79,7 +79,7 @@
* @return the mapped NumberTransformer or null.
*/
public NumberTransformer getTransformer(Class<?> key) {
- return (NumberTransformer) map.get(key);
+ return map.get(key);
}
/**