You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2011/06/26 21:13:07 UTC
svn commit: r1139915 - in
/commons/proper/math/trunk/src/main/java/org/apache/commons/math: filter/
geometry/euclidean/twod/ geometry/partitioning/ optimization/direct/
stat/clustering/ stat/inference/
Author: luc
Date: Sun Jun 26 19:13:06 2011
New Revision: 1139915
URL: http://svn.apache.org/viewvc?rev=1139915&view=rev
Log:
Fixed checkstyle, javadoc, findbugs and eclipse warnings.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/filter/KalmanFilter.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSet.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/filter/KalmanFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/filter/KalmanFilter.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/filter/KalmanFilter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/filter/KalmanFilter.java Sun Jun 26 19:13:06 2011
@@ -81,8 +81,6 @@ import org.apache.commons.math.util.Math
* @version $Id$
*/
public class KalmanFilter {
- /** Serializable version identifier. */
- private static final long serialVersionUID = 4878026651422612760L;
/** The process model used by this filter instance. */
private final ProcessModel processModel;
/** The measurement model used by this filter instance. */
@@ -343,8 +341,8 @@ public class KalmanFilter {
*/
public void correct(final RealVector z) {
// sanity checks
- if (z != null &&
- z.getDimension() != measurementMatrix.getRowDimension()) {
+ MathUtils.checkNotNull(z);
+ if (z.getDimension() != measurementMatrix.getRowDimension()) {
throw new DimensionMismatchException(z.getDimension(),
measurementMatrix.getRowDimension());
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSet.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSet.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSet.java Sun Jun 26 19:13:06 2011
@@ -345,6 +345,7 @@ public class PolygonsSet extends Abstrac
}
+ /** Private extension of Segment allowing comparison. */
private static class ComparableSegment extends Segment implements Comparable<ComparableSegment> {
/** Sorting key. */
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java Sun Jun 26 19:13:06 2011
@@ -133,9 +133,6 @@ public abstract class AbstractRegion<S e
}
- /** {@inheritDoc} */
- public abstract AbstractRegion<S, T> buildNew(BSPTree<S> newTree);
-
/** Build a convex region from an array of bounding hyperplanes.
* @param hyperplanes array of bounding hyperplanes (if null, an
* empty region will be built)
@@ -164,6 +161,9 @@ public abstract class AbstractRegion<S e
}
+ /** {@inheritDoc} */
+ public abstract AbstractRegion<S, T> buildNew(BSPTree<S> newTree);
+
/** Recursively build a tree by inserting cut sub-hyperplanes.
* @param node current tree node (it is a leaf node at the beginning
* of the call)
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java Sun Jun 26 19:13:06 2011
@@ -855,6 +855,30 @@ public class CMAESOptimizer extends
public int compareTo(DoubleIndex o) {
return Double.compare(value, o.value);
}
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean equals(Object other) {
+
+ if (this == other) {
+ return true;
+ }
+
+ if (other instanceof DoubleIndex) {
+ return Double.compare(value, ((DoubleIndex) other).value) == 0;
+ }
+
+ return false;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public int hashCode() {
+ long bits = Double.doubleToLongBits(value);
+ return (int) ((1438542 ^ (bits >>> 32) ^ bits) & 0xffffffff);
+ }
+
}
/**
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java Sun Jun 26 19:13:06 2011
@@ -89,8 +89,9 @@ public class KMeansPlusPlusClusterer<T e
*
* @param points the points to cluster
* @param k the number of clusters to split the data into
- * @param maxIterations the maximum number of iterations to run the algorithm
- * for. If negative, no maximum will be used
+ * @param numTrials number of trial runs
+ * @param maxIterationsPerTrial the maximum number of iterations to run the algorithm
+ * for at each trial run. If negative, no maximum will be used
* @return a list of clusters containing the points
* @throws MathIllegalArgumentException if the data points are null or the number
* of clusters is larger than the number of data points
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=1139915&r1=1139914&r2=1139915&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java Sun Jun 26 19:13:06 2011
@@ -356,7 +356,7 @@ public class ChiSquareTestImpl implement
* Check all entries of the input array are strictly positive.
*
* @param in Array to be tested.
- * @exception NotStrictlyPositiveException if one entry is not positive.
+ * @exception MathIllegalArgumentException if one entry is not positive.
*/
private void checkPositive(double[] in) {
for (int i = 0; i < in.length; i++) {
@@ -372,7 +372,7 @@ public class ChiSquareTestImpl implement
* Check all entries of the input array are >= 0.
*
* @param in Array to be tested.
- * @exception NotPositiveException if one entry is negative.
+ * @exception MathIllegalArgumentException if one entry is negative.
*/
private void checkNonNegative(long[] in) {
for (int i = 0; i < in.length; i++) {
@@ -388,7 +388,7 @@ public class ChiSquareTestImpl implement
* Check all entries of the input array are >= 0.
*
* @param in Array to be tested.
- * @exception NotPositiveException if one entry is negative.
+ * @exception MathIllegalArgumentException if one entry is negative.
*/
private void checkNonNegative(long[][] in) {
for (int i = 0; i < in.length; i ++) {