You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2011/04/12 13:29:02 UTC
svn commit: r1091376 - in
/commons/proper/math/trunk/src/main/java/org/apache/commons/math:
optimization/linear/SimplexSolver.java
optimization/linear/SimplexTableau.java
stat/clustering/KMeansPlusPlusClusterer.java
Author: erans
Date: Tue Apr 12 11:29:02 2011
New Revision: 1091376
URL: http://svn.apache.org/viewvc?rev=1091376&view=rev
Log:
Trailing spaces.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/KMeansPlusPlusClusterer.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java?rev=1091376&r1=1091375&r2=1091376&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexSolver.java Tue Apr 12 11:29:02 2011
@@ -31,10 +31,10 @@ import org.apache.commons.math.util.Math
* @since 2.0
*/
public class SimplexSolver extends AbstractLinearOptimizer {
-
+
/** Default amount of error to accept for algorithm convergence. */
private static final double DEFAULT_EPSILON = 1.0e-6;
-
+
/** Amount of error to accept for algorithm convergence. */
protected final double epsilon;
@@ -54,7 +54,7 @@ public class SimplexSolver extends Abstr
/**
* Build a simplex solver with a specified accepted amount of error
* @param epsilon the amount of error to accept for algorithm convergence
- * @param maxUlps amount of error to accept in floating point comparisons
+ * @param maxUlps amount of error to accept in floating point comparisons
*/
public SimplexSolver(final double epsilon, final int maxUlps) {
this.epsilon = epsilon;
@@ -92,7 +92,7 @@ public class SimplexSolver extends Abstr
for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) {
final double rhs = tableau.getEntry(i, tableau.getWidth() - 1);
final double entry = tableau.getEntry(i, col);
-
+
if (MathUtils.compareTo(entry, 0d, maxUlps) > 0) {
final double ratio = rhs / entry;
final int cmp = MathUtils.compareTo(ratio, minRatio, maxUlps);
@@ -183,7 +183,7 @@ public class SimplexSolver extends Abstr
@Override
public RealPointValuePair doOptimize() throws OptimizationException {
final SimplexTableau tableau =
- new SimplexTableau(function, linearConstraints, goal, nonNegative,
+ new SimplexTableau(function, linearConstraints, goal, nonNegative,
epsilon, maxUlps);
solvePhase1(tableau);
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java?rev=1091376&r1=1091375&r2=1091376&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/SimplexTableau.java Tue Apr 12 11:29:02 2011
@@ -116,7 +116,7 @@ class SimplexTableau implements Serializ
final double epsilon) {
this(f, constraints, goalType, restrictToNonNegative, epsilon, DEFAULT_ULPS);
}
-
+
/**
* Build a tableau for a linear problem.
* @param f linear objective function
@@ -125,7 +125,7 @@ class SimplexTableau implements Serializ
* or {@link GoalType#MINIMIZE}
* @param restrictToNonNegative whether to restrict the variables to non-negative values
* @param epsilon amount of error to accept when checking for optimality
- * @param maxUlps amount of error to accept in floating point comparisons
+ * @param maxUlps amount of error to accept in floating point comparisons
*/
SimplexTableau(final LinearObjectiveFunction f,
final Collection<LinearConstraint> constraints,
@@ -614,5 +614,5 @@ class SimplexTableau implements Serializ
throws ClassNotFoundException, IOException {
ois.defaultReadObject();
MatrixUtils.deserializeRealMatrix(this, "tableau", ois);
- }
+ }
}
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=1091376&r1=1091375&r2=1091376&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 Tue Apr 12 11:29:02 2011
@@ -108,7 +108,7 @@ public class KMeansPlusPlusClusterer<T e
// create the initial clusters
List<Cluster<T>> clusters = chooseInitialCenters(points, k, random);
-
+
// create an array containing the latest assignment of a point to a cluster
// no need to initialize the array, as it will be filled with the first assignment
int[] assignments = new int[points.size()];
@@ -143,7 +143,7 @@ public class KMeansPlusPlusClusterer<T e
}
int changes = assignPointsToClusters(newClusters, points, assignments);
clusters = newClusters;
-
+
// if there were no more changes in the point-to-cluster assignment
// and there are no empty clusters left, return the current clusters
if (changes == 0 && !emptyCluster) {
@@ -162,7 +162,7 @@ public class KMeansPlusPlusClusterer<T e
* @return the number of points assigned to different clusters as the iteration before
*/
private static <T extends Clusterable<T>> int
- assignPointsToClusters(final List<Cluster<T>> clusters, final Collection<T> points,
+ assignPointsToClusters(final List<Cluster<T>> clusters, final Collection<T> points,
final int[] assignments) {
int assignedDifferently = 0;
int pointIndex = 0;
@@ -171,12 +171,12 @@ public class KMeansPlusPlusClusterer<T e
if (clusterIndex != assignments[pointIndex]) {
assignedDifferently++;
}
-
+
Cluster<T> cluster = clusters.get(clusterIndex);
cluster.addPoint(p);
assignments[pointIndex++] = clusterIndex;
}
-
+
return assignedDifferently;
}