You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2009/09/05 19:37:05 UTC

svn commit: r811685 [9/24] - in /commons/proper/math/trunk: ./ src/main/java/org/apache/commons/math/ src/main/java/org/apache/commons/math/analysis/ src/main/java/org/apache/commons/math/analysis/integration/ src/main/java/org/apache/commons/math/anal...

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/special/Gamma.java Sat Sep  5 17:36:48 2009
@@ -27,8 +27,8 @@
  * @version $Revision$ $Date$
  */
 public class Gamma {
-    
-    /** 
+
+    /**
      * <a href="http://en.wikipedia.org/wiki/Euler-Mascheroni_constant">Euler-Mascheroni constant</a>
      * @since 2.0
      */
@@ -81,7 +81,7 @@
      * the computation of the convergent Lanczos complex Gamma approximation
      * </a></li>
      * </ul>
-     * 
+     *
      * @param x the value.
      * @return log(&#915;(x))
      */
@@ -92,7 +92,7 @@
             ret = Double.NaN;
         } else {
             double g = 607.0 / 128.0;
-            
+
             double sum = 0.0;
             for (int i = LANCZOS.length - 1; i > 0; --i) {
                 sum = sum + (LANCZOS[i] / (x + i));
@@ -109,7 +109,7 @@
 
     /**
      * Returns the regularized gamma function P(a, x).
-     * 
+     *
      * @param a the a parameter.
      * @param x the value.
      * @return the regularized gamma function P(a, x)
@@ -120,11 +120,11 @@
     {
         return regularizedGammaP(a, x, DEFAULT_EPSILON, Integer.MAX_VALUE);
     }
-        
-        
+
+
     /**
      * Returns the regularized gamma function P(a, x).
-     * 
+     *
      * The implementation of this method is based on:
      * <ul>
      * <li>
@@ -138,20 +138,20 @@
      * Confluent Hypergeometric Function of the First Kind</a>, equation (1).
      * </li>
      * </ul>
-     * 
+     *
      * @param a the a parameter.
      * @param x the value.
      * @param epsilon When the absolute value of the nth item in the
      *                series is less than epsilon the approximation ceases
      *                to calculate further elements in the series.
-     * @param maxIterations Maximum number of "iterations" to complete. 
+     * @param maxIterations Maximum number of "iterations" to complete.
      * @return the regularized gamma function P(a, x)
      * @throws MathException if the algorithm fails to converge.
      */
-    public static double regularizedGammaP(double a, 
-                                           double x, 
-                                           double epsilon, 
-                                           int maxIterations) 
+    public static double regularizedGammaP(double a,
+                                           double x,
+                                           double epsilon,
+                                           int maxIterations)
         throws MathException
     {
         double ret;
@@ -186,10 +186,10 @@
 
         return ret;
     }
-    
+
     /**
      * Returns the regularized gamma function Q(a, x) = 1 - P(a, x).
-     * 
+     *
      * @param a the a parameter.
      * @param x the value.
      * @return the regularized gamma function Q(a, x)
@@ -200,10 +200,10 @@
     {
         return regularizedGammaQ(a, x, DEFAULT_EPSILON, Integer.MAX_VALUE);
     }
-    
+
     /**
      * Returns the regularized gamma function Q(a, x) = 1 - P(a, x).
-     * 
+     *
      * The implementation of this method is based on:
      * <ul>
      * <li>
@@ -213,20 +213,20 @@
      * <a href="    http://functions.wolfram.com/GammaBetaErf/GammaRegularized/10/0003/">
      * Regularized incomplete gamma function: Continued fraction representations  (formula 06.08.10.0003)</a></li>
      * </ul>
-     * 
+     *
      * @param a the a parameter.
      * @param x the value.
      * @param epsilon When the absolute value of the nth item in the
      *                series is less than epsilon the approximation ceases
      *                to calculate further elements in the series.
-     * @param maxIterations Maximum number of "iterations" to complete. 
+     * @param maxIterations Maximum number of "iterations" to complete.
      * @return the regularized gamma function P(a, x)
      * @throws MathException if the algorithm fails to converge.
      */
-    public static double regularizedGammaQ(final double a, 
-                                           double x, 
-                                           double epsilon, 
-                                           int maxIterations) 
+    public static double regularizedGammaQ(final double a,
+                                           double x,
+                                           double epsilon,
+                                           int maxIterations)
         throws MathException
     {
         double ret;
@@ -253,7 +253,7 @@
                     return n * (a - n);
                 }
             };
-            
+
             ret = 1.0 / cf.evaluate(x, epsilon, maxIterations);
             ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * ret;
         }
@@ -270,18 +270,18 @@
 
     /**
      * <p>Computes the digamma function of x.</p>
-     * 
+     *
      * <p>This is an independently written implementation of the algorithm described in
      * Jose Bernardo, Algorithm AS 103: Psi (Digamma) Function, Applied Statistics, 1976.</p>
-     * 
+     *
      * <p>Some of the constants have been changed to increase accuracy at the moderate expense
      * of run-time.  The result should be accurate to within 10^-8 absolute tolerance for
      * x >= 10^-5 and within 10^-8 relative tolerance for x > 0.</p>
-     * 
+     *
      * <p>Performance for large negative values of x will be quite expensive (proportional to
      * |x|).  Accuracy for negative values of x should be about 10^-8 absolute for results
      * less than 10^5 and 10^-8 relative for results larger than that.</p>
-     * 
+     *
      * @param x  the argument
      * @return   digamma(x) to within 10-8 relative or absolute error whichever is smaller
      * @see <a href="http://en.wikipedia.org/wiki/Digamma_function"> Digamma at wikipedia </a>
@@ -310,7 +310,7 @@
     /**
      * <p>Computes the trigamma function of x.  This function is derived by taking the derivative of
      * the implementation of digamma.</p>
-     * 
+     *
      * @param x  the argument
      * @return   trigamma(x) to within 10-8 relative or absolute error whichever is smaller
      * @see <a href="http://en.wikipedia.org/wiki/Trigamma_function"> Trigamma at wikipedia </a>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/Frequency.java Sat Sep  5 17:36:48 2009
@@ -24,14 +24,14 @@
 
 import org.apache.commons.math.MathRuntimeException;
 
-/** 
+/**
  * Maintains a frequency distribution.
  * <p>
- * Accepts int, long, char or Comparable values.  New values added must be 
- * comparable to those that have been added, otherwise the add method will 
+ * Accepts int, long, char or Comparable values.  New values added must be
+ * comparable to those that have been added, otherwise the add method will
  * throw an IllegalArgumentException.</p>
  * <p>
- * Integer values (int, long, Integer, Long) are not distinguished by type -- 
+ * Integer values (int, long, Integer, Long) are not distinguished by type --
  * i.e. <code>addValue(Long.valueOf(2)), addValue(2), addValue(2l)</code> all have
  * the same effect (similarly for arguments to <code>getCount,</code> etc.).</p>
  * <p>
@@ -40,13 +40,13 @@
  * to combine integral types with chars in a frequency distribution will fail.
  * </p>
  * <p>
- * The values are ordered using the default (natural order), unless a  
+ * The values are ordered using the default (natural order), unless a
  * <code>Comparator</code> is supplied in the constructor.</p>
  *
  * @version $Revision$ $Date$
  */
 public class Frequency implements Serializable {
-    
+
     /** Serializable version identifier */
     private static final long serialVersionUID = -3845586908418844111L;
 
@@ -59,10 +59,10 @@
     public Frequency() {
         freqTable = new TreeMap<Comparable<?>, Long>();
     }
-    
+
     /**
      * Constructor allowing values Comparator to be specified.
-     * 
+     *
      * @param comparator Comparator used to order values
      */
     @SuppressWarnings("unchecked")
@@ -73,7 +73,7 @@
     /**
      * Return a string representation of this frequency
      * distribution.
-     * 
+     *
      * @return a string representation.
      */
     @Override
@@ -102,30 +102,30 @@
      * If other objects have already been added to this Frequency, v must
      * be comparable to those that have already been added.
      * </p>
-     * 
+     *
      * @param v the value to add.
-     * @throws IllegalArgumentException if <code>v</code> is not Comparable, 
+     * @throws IllegalArgumentException if <code>v</code> is not Comparable,
      *         or is not comparable with previous entries
      * @deprecated use {@link #addValue(Comparable)} instead
      */
     @Deprecated
     public void addValue(Object v) {
         if (v instanceof Comparable<?>){
-            addValue((Comparable<?>) v);            
+            addValue((Comparable<?>) v);
         } else {
             throw MathRuntimeException.createIllegalArgumentException(
                   "class ({0}) does not implement Comparable",
                   v.getClass().getName());
         }
     }
-    
+
     /**
      * Adds 1 to the frequency count for v.
      * <p>
      * If other objects have already been added to this Frequency, v must
      * be comparable to those that have already been added.
      * </p>
-     * 
+     *
      * @param v the value to add.
      * @throws IllegalArgumentException if <code>v</code> is not comparable with previous entries
      */
@@ -141,7 +141,7 @@
             } else {
                 freqTable.put(obj, Long.valueOf(count.longValue() + 1));
             }
-        } catch (ClassCastException ex) {   
+        } catch (ClassCastException ex) {
             //TreeMap will throw ClassCastException if v is not comparable
             throw MathRuntimeException.createIllegalArgumentException(
                   "instance of class {0} not comparable to existing values",
@@ -151,16 +151,16 @@
 
     /**
      * Adds 1 to the frequency count for v.
-     * 
+     *
      * @param v the value to add.
      */
     public void addValue(int v) {
         addValue(Long.valueOf(v));
     }
-    
+
     /**
      * Adds 1 to the frequency count for v.
-     * 
+     *
      * @param v the value to add.
      */
     public void addValue(Integer v) {
@@ -169,45 +169,45 @@
 
     /**
      * Adds 1 to the frequency count for v.
-     * 
+     *
      * @param v the value to add.
      */
     public void addValue(long v) {
         addValue(Long.valueOf(v));
     }
-    
+
     /**
      * Adds 1 to the frequency count for v.
-     * 
+     *
      * @param v the value to add.
      */
     public void addValue(char v) {
         addValue(Character.valueOf(v));
     }
-    
+
     /** Clears the frequency table */
     public void clear() {
         freqTable.clear();
     }
-    
+
     /**
      * Returns an Iterator over the set of values that have been added.
      * <p>
-     * If added values are integral (i.e., integers, longs, Integers, or Longs), 
+     * If added values are integral (i.e., integers, longs, Integers, or Longs),
      * they are converted to Longs when they are added, so the objects returned
      * by the Iterator will in this case be Longs.</p>
-     * 
+     *
      * @return values Iterator
      */
     public Iterator<Comparable<?>> valuesIterator() {
         return freqTable.keySet().iterator();
     }
-    
+
     //-------------------------------------------------------------------------
-    
+
     /**
      * Returns the sum of all frequencies.
-     * 
+     *
      * @return the total frequency count.
      */
     public long getSumFreq() {
@@ -222,7 +222,7 @@
     /**
      * Returns the number of values = v.
      * Returns 0 if the value is not comparable.
-     * 
+     *
      * @param v the value to lookup.
      * @return the frequency of v.
      * @deprecated replaced by {@link #getCount(Comparable)} as of 2.0
@@ -235,7 +235,7 @@
     /**
      * Returns the number of values = v.
      * Returns 0 if the value is not comparable.
-     * 
+     *
      * @param v the value to lookup.
      * @return the frequency of v.
      */
@@ -244,7 +244,7 @@
             return getCount(((Integer) v).longValue());
         }
         long result = 0;
-        try { 
+        try {
             Long count =  freqTable.get(v);
             if (count != null) {
                 result = count.longValue();
@@ -257,34 +257,34 @@
 
     /**
      * Returns the number of values = v.
-     * 
+     *
      * @param v the value to lookup.
      * @return the frequency of v.
      */
     public long getCount(int v) {
         return getCount(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the number of values = v.
-     * 
+     *
      * @param v the value to lookup.
      * @return the frequency of v.
      */
     public long getCount(long v) {
         return getCount(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the number of values = v.
-     * 
+     *
      * @param v the value to lookup.
      * @return the frequency of v.
      */
     public long getCount(char v) {
         return getCount(Character.valueOf(v));
     }
-    
+
     //-------------------------------------------------------------
 
     /**
@@ -292,7 +292,7 @@
      * (as a proportion between 0 and 1).
      * <p>
      * Returns <code>Double.NaN</code> if no values have been added.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      * @deprecated replaced by {@link #getPct(Comparable)} as of 2.0
@@ -307,7 +307,7 @@
      * (as a proportion between 0 and 1).
      * <p>
      * Returns <code>Double.NaN</code> if no values have been added.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
@@ -316,49 +316,49 @@
         if (sumFreq == 0) {
             return Double.NaN;
         }
-        return (double) getCount(v) / (double) sumFreq;        
+        return (double) getCount(v) / (double) sumFreq;
     }
-    
+
     /**
      * Returns the percentage of values that are equal to v
      * (as a proportion between 0 and 1).
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public double getPct(int v) {
-        return getPct(Long.valueOf(v));       
+        return getPct(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the percentage of values that are equal to v
      * (as a proportion between 0 and 1).
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public double getPct(long v) {
-        return getPct(Long.valueOf(v));         
+        return getPct(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the percentage of values that are equal to v
      * (as a proportion between 0 and 1).
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public double getPct(char v) {
-        return getPct(Character.valueOf(v));         
+        return getPct(Character.valueOf(v));
     }
-    
+
     //-----------------------------------------------------------------------------------------
-    
+
     /**
      * Returns the cumulative frequency of values less than or equal to v.
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup.
      * @return the proportion of values equal to v
      * @deprecated replaced by {@link #getCumFreq(Comparable)} as of 2.0
@@ -372,7 +372,7 @@
      * Returns the cumulative frequency of values less than or equal to v.
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup.
      * @return the proportion of values equal to v
      */
@@ -389,7 +389,7 @@
             c = new NaturalComparator();
         }
         long result = 0;
-        
+
         try {
             Long value = freqTable.get(v);
             if (value != null) {
@@ -402,11 +402,11 @@
         if (c.compare(v, freqTable.firstKey()) < 0) {
             return 0;  // v is comparable, but less than first value
         }
-        
+
         if (c.compare(v, freqTable.lastKey()) >= 0) {
             return getSumFreq();    // v is comparable, but greater than the last value
         }
-        
+
         Iterator<Comparable<?>> values = valuesIterator();
         while (values.hasNext()) {
             Comparable<?> nextValue = values.next();
@@ -418,45 +418,45 @@
         }
         return result;
     }
-    
+
      /**
      * Returns the cumulative frequency of values less than or equal to v.
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public long getCumFreq(int v) {
-        return getCumFreq(Long.valueOf(v));       
+        return getCumFreq(Long.valueOf(v));
     }
-    
+
      /**
      * Returns the cumulative frequency of values less than or equal to v.
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public long getCumFreq(long v) {
-        return getCumFreq(Long.valueOf(v));         
+        return getCumFreq(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the cumulative frequency of values less than or equal to v.
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values equal to v
      */
     public long getCumFreq(char v) {
-        return getCumFreq(Character.valueOf(v));         
+        return getCumFreq(Character.valueOf(v));
     }
-    
+
     //----------------------------------------------------------------------------------------------
-    
+
     /**
      * Returns the cumulative percentage of values less than or equal to v
      * (as a proportion between 0 and 1).
@@ -464,7 +464,7 @@
      * Returns <code>Double.NaN</code> if no values have been added.
      * Returns 0 if at least one value has been added, but v is not comparable
      * to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values less than or equal to v
      * @deprecated replaced by {@link #getCumPct(Comparable)} as of 2.0
@@ -472,7 +472,7 @@
     @Deprecated
     public double getCumPct(Object v) {
         return getCumPct((Comparable<?>) v);
-        
+
     }
 
     /**
@@ -482,7 +482,7 @@
      * Returns <code>Double.NaN</code> if no values have been added.
      * Returns 0 if at least one value has been added, but v is not comparable
      * to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values less than or equal to v
      */
@@ -491,48 +491,48 @@
         if (sumFreq == 0) {
             return Double.NaN;
         }
-        return (double) getCumFreq(v) / (double) sumFreq;        
+        return (double) getCumFreq(v) / (double) sumFreq;
     }
-    
+
     /**
      * Returns the cumulative percentage of values less than or equal to v
      * (as a proportion between 0 and 1).
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values less than or equal to v
      */
     public double getCumPct(int v) {
-        return getCumPct(Long.valueOf(v));       
+        return getCumPct(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the cumulative percentage of values less than or equal to v
      * (as a proportion between 0 and 1).
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values less than or equal to v
      */
     public double getCumPct(long v) {
-        return getCumPct(Long.valueOf(v));         
+        return getCumPct(Long.valueOf(v));
     }
-    
+
     /**
      * Returns the cumulative percentage of values less than or equal to v
      * (as a proportion between 0 and 1).
      * <p>
      * Returns 0 if v is not comparable to the values set.</p>
-     * 
+     *
      * @param v the value to lookup
      * @return the proportion of values less than or equal to v
      */
     public double getCumPct(char v) {
-        return getCumPct(Character.valueOf(v));         
+        return getCumPct(Character.valueOf(v));
     }
-    
+
     /**
      * A Comparator that compares comparable objects using the
      * natural order.  Copied from Commons Collections ComparableComparator.
@@ -546,13 +546,13 @@
          * Compare the two {@link Comparable Comparable} arguments.
          * This method is equivalent to:
          * <pre>(({@link Comparable Comparable})o1).{@link Comparable#compareTo compareTo}(o2)</pre>
-         * 
-         * @param  o1 the first object 
+         *
+         * @param  o1 the first object
          * @param  o2 the second object
          * @return  result of comparison
-         * @throws NullPointerException when <i>o1</i> is <code>null</code>, 
+         * @throws NullPointerException when <i>o1</i> is <code>null</code>,
          *         or when <code>((Comparable)o1).compareTo(o2)</code> does
-         * @throws ClassCastException when <i>o1</i> is not a {@link Comparable Comparable}, 
+         * @throws ClassCastException when <i>o1</i> is not a {@link Comparable Comparable},
          *         or when <code>((Comparable)o1).compareTo(o2)</code> does
          */
         @SuppressWarnings("unchecked")

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/StatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/StatUtils.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/StatUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/StatUtils.java Sat Sep  5 17:36:48 2009
@@ -31,8 +31,8 @@
 
 /**
  * StatUtils provides static methods for computing statistics based on data
- * stored in double[] arrays. 
- * 
+ * stored in double[] arrays.
+ *
  * @version $Revision$ $Date$
  */
 public final class StatUtils {
@@ -63,7 +63,7 @@
 
     /** percentile */
     private static final Percentile PERCENTILE = new Percentile();
-    
+
     /** geometric mean */
     private static final GeometricMean GEOMETRIC_MEAN = new GeometricMean();
 
@@ -79,7 +79,7 @@
      * <p>
      * Throws <code>IllegalArgumentException</code> if the input array
      * is null.</p>
-     * 
+     *
      * @param values  array of values to sum
      * @return the sum of the values or <code>Double.NaN</code> if the array
      * is empty
@@ -95,7 +95,7 @@
      * is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -103,17 +103,17 @@
      * @throws IllegalArgumentException if the array is null or the array index
      *  parameters are not valid
      */
-    public static double sum(final double[] values, final int begin, 
+    public static double sum(final double[] values, final int begin,
             final int length) {
         return SUM.evaluate(values, begin, length);
     }
 
     /**
-     * Returns the sum of the squares of the entries in the input array, or 
+     * Returns the sum of the squares of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values  input array
      * @return the sum of the squared values or <code>Double.NaN</code> if the
      * array is empty
@@ -129,7 +129,7 @@
      * is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -143,11 +143,11 @@
     }
 
     /**
-     * Returns the product of the entries in the input array, or 
+     * Returns the product of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @return the product of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -162,7 +162,7 @@
      * is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -176,16 +176,16 @@
     }
 
     /**
-     * Returns the sum of the natural logs of the entries in the input array, or 
+     * Returns the sum of the natural logs of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.summary.SumOfLogs}.
      * </p>
-     * 
+     *
      * @param values the input array
-     * @return the sum of the natural logs of the values or Double.NaN if 
+     * @return the sum of the natural logs of the values or Double.NaN if
      * the array is empty
      * @throws IllegalArgumentException if the array is null
      */
@@ -202,11 +202,11 @@
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.summary.SumOfLogs}.
      * </p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
-     * @return the sum of the natural logs of the values or Double.NaN if 
+     * @return the sum of the natural logs of the values or Double.NaN if
      * length = 0
      * @throws IllegalArgumentException if the array is null or the array index
      * parameters are not valid
@@ -217,14 +217,14 @@
     }
 
     /**
-     * Returns the arithmetic mean of the entries in the input array, or 
+     * Returns the arithmetic mean of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.Mean} for
      * details on the computing algorithm.</p>
-     * 
+     *
      * @param values the input array
      * @return the mean of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -242,7 +242,7 @@
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.Mean} for
      * details on the computing algorithm.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -254,16 +254,16 @@
             final int length) {
         return MEAN.evaluate(values, begin, length);
     }
-    
+
     /**
-     * Returns the geometric mean of the entries in the input array, or 
+     * Returns the geometric mean of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.GeometricMean}
      * for details on the computing algorithm.</p>
-     * 
+     *
      * @param values the input array
      * @return the geometric mean of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -281,7 +281,7 @@
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.GeometricMean}
      * for details on the computing algorithm.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -293,10 +293,10 @@
             final int length) {
         return GEOMETRIC_MEAN.evaluate(values, begin, length);
     }
-    
+
 
     /**
-     * Returns the variance of the entries in the input array, or 
+     * Returns the variance of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for
@@ -305,7 +305,7 @@
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @return the variance of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -326,7 +326,7 @@
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null or the
      * array index parameters are not valid.</p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -338,10 +338,10 @@
             final int length) {
         return VARIANCE.evaluate(values, begin, length);
     }
-    
+
     /**
      * Returns the variance of the entries in the specified portion of
-     * the input array, using the precomputed mean value.  Returns 
+     * the input array, using the precomputed mean value.  Returns
      * <code>Double.NaN</code> if the designated subarray is empty.
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for
@@ -356,7 +356,7 @@
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null or the
      * array index parameters are not valid.</p>
-     * 
+     *
      * @param values the input array
      * @param mean the precomputed mean value
      * @param begin index of the first array element to include
@@ -365,18 +365,18 @@
      * @throws IllegalArgumentException if the array is null or the array index
      *  parameters are not valid
      */
-    public static double variance(final double[] values, final double mean, 
+    public static double variance(final double[] values, final double mean,
             final int begin, final int length) {
-        return VARIANCE.evaluate(values, mean, begin, length);    
+        return VARIANCE.evaluate(values, mean, begin, length);
     }
-    
+
     /**
      * Returns the variance of the entries in the input array, using the
      * precomputed mean value.  Returns <code>Double.NaN</code> if the array
-     * is empty.  
+     * is empty.
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.moment.Variance} for
-     * details on the computing algorithm.</p>  
+     * details on the computing algorithm.</p>
      * <p>
      * The formula used assumes that the supplied mean value is the arithmetic
      * mean of the sample data, not a known population parameter.  This method
@@ -386,29 +386,29 @@
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
-     * 
+     *
      * @param values the input array
      * @param mean the precomputed mean value
      * @return the variance of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
      */
     public static double variance(final double[] values, final double mean) {
-        return VARIANCE.evaluate(values, mean);    
+        return VARIANCE.evaluate(values, mean);
     }
 
     /**
-     * Returns the maximum of the entries in the input array, or 
+     * Returns the maximum of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
      * <ul>
-     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code> 
+     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code>
      * (i.e. <code>NaN</code> values have no impact on the value of the statistic).</li>
-     * <li>If any of the values equals <code>Double.POSITIVE_INFINITY</code>, 
+     * <li>If any of the values equals <code>Double.POSITIVE_INFINITY</code>,
      * the result is <code>Double.POSITIVE_INFINITY.</code></li>
      * </ul></p>
-     * 
+     *
      * @param values the input array
      * @return the maximum of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -426,12 +426,12 @@
      * the array index parameters are not valid.</p>
      * <p>
      * <ul>
-     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code> 
+     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code>
      * (i.e. <code>NaN</code> values have no impact on the value of the statistic).</li>
-     * <li>If any of the values equals <code>Double.POSITIVE_INFINITY</code>, 
+     * <li>If any of the values equals <code>Double.POSITIVE_INFINITY</code>,
      * the result is <code>Double.POSITIVE_INFINITY.</code></li>
      * </ul></p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -445,18 +445,18 @@
     }
 
      /**
-     * Returns the minimum of the entries in the input array, or 
+     * Returns the minimum of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
      * <ul>
-     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code> 
+     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code>
      * (i.e. <code>NaN</code> values have no impact on the value of the statistic).</li>
-     * <li>If any of the values equals <code>Double.NEGATIVE_INFINITY</code>, 
+     * <li>If any of the values equals <code>Double.NEGATIVE_INFINITY</code>,
      * the result is <code>Double.NEGATIVE_INFINITY.</code></li>
      * </ul> </p>
-     * 
+     *
      * @param values the input array
      * @return the minimum of the values or Double.NaN if the array is empty
      * @throws IllegalArgumentException if the array is null
@@ -474,12 +474,12 @@
      * the array index parameters are not valid.</p>
      * <p>
      * <ul>
-     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code> 
+     * <li>The result is <code>NaN</code> iff all values are <code>NaN</code>
      * (i.e. <code>NaN</code> values have no impact on the value of the statistic).</li>
-     * <li>If any of the values equals <code>Double.NEGATIVE_INFINITY</code>, 
+     * <li>If any of the values equals <code>Double.NEGATIVE_INFINITY</code>,
      * the result is <code>Double.NEGATIVE_INFINITY.</code></li>
      * </ul></p>
-     * 
+     *
      * @param values the input array
      * @param begin index of the first array element to include
      * @param length the number of elements to include
@@ -491,13 +491,13 @@
             final int length) {
         return MIN.evaluate(values, begin, length);
     }
-    
+
     /**
      * Returns an estimate of the <code>p</code>th percentile of the values
      * in the <code>values</code> array.
      * <p>
      * <ul>
-     * <li>Returns <code>Double.NaN</code> if <code>values</code> has length 
+     * <li>Returns <code>Double.NaN</code> if <code>values</code> has length
      * <code>0</code></li></p>
      * <li>Returns (for any value of <code>p</code>) <code>values[0]</code>
      *  if <code>values</code> has length <code>1</code></li>
@@ -508,11 +508,11 @@
      * <p>
      * See {@link org.apache.commons.math.stat.descriptive.rank.Percentile} for
      * a description of the percentile estimation algorithm used.</p>
-     * 
+     *
      * @param values input array of values
      * @param p the percentile value to compute
      * @return the percentile value or Double.NaN if the array is empty
-     * @throws IllegalArgumentException if <code>values</code> is null 
+     * @throws IllegalArgumentException if <code>values</code> is null
      * or p is invalid
      */
     public static double percentile(final double[] values, final double p) {
@@ -530,14 +530,14 @@
      * <li>Returns (for any value of <code>p</code>) <code>values[begin]</code>
      *  if <code>length = 1 </code></li>
      * <li>Throws <code>IllegalArgumentException</code> if <code>values</code>
-     *  is null , <code>begin</code> or <code>length</code> is invalid, or 
+     *  is null , <code>begin</code> or <code>length</code> is invalid, or
      * <code>p</code> is not a valid quantile value (p must be greater than 0
      * and less than or equal to 100)</li>
      * </ul></p>
      * <p>
       * See {@link org.apache.commons.math.stat.descriptive.rank.Percentile} for
       * a description of the percentile estimation algorithm used.</p>
-     * 
+     *
      * @param values array of input values
      * @param p  the percentile to compute
      * @param begin  the first (0-based) element to include in the computation
@@ -546,15 +546,15 @@
      * @throws IllegalArgumentException if the parameters are not valid or the
      * input array is null
      */
-    public static double percentile(final double[] values, final int begin, 
+    public static double percentile(final double[] values, final int begin,
             final int length, final double p) {
         return PERCENTILE.evaluate(values, begin, length, p);
-    }   
-    
+    }
+
     /**
      * Returns the sum of the (signed) differences between corresponding elements of the
      * input arrays -- i.e., sum(sample1[i] - sample2[i]).
-     * 
+     *
      * @param sample1  the first array
      * @param sample2  the second array
      * @return sum of paired differences
@@ -575,11 +575,11 @@
         }
         return result;
     }
-    
+
     /**
      * Returns the mean of the (signed) differences between corresponding elements of the
      * input arrays -- i.e., sum(sample1[i] - sample2[i]) / sample1.length.
-     * 
+     *
      * @param sample1  the first array
      * @param sample2  the second array
      * @return mean of paired differences
@@ -590,20 +590,20 @@
     throws IllegalArgumentException {
         return sumDifference(sample1, sample2) / sample1.length;
     }
-    
+
     /**
      * Returns the variance of the (signed) differences between corresponding elements of the
      * input arrays -- i.e., var(sample1[i] - sample2[i]).
-     * 
+     *
      * @param sample1  the first array
      * @param sample2  the second array
-     * @param meanDifference   the mean difference between corresponding entries 
+     * @param meanDifference   the mean difference between corresponding entries
      * @see #meanDifference(double[],double[])
      * @return variance of paired differences
      * @throws IllegalArgumentException if the arrays do not have the same
      * length or their common length is less than 2.
      */
-    public static double varianceDifference(final double[] sample1, final double[] sample2, 
+    public static double varianceDifference(final double[] sample1, final double[] sample2,
             double meanDifference)  throws IllegalArgumentException {
         double sum1 = 0d;
         double sum2 = 0d;
@@ -620,6 +620,6 @@
             sum2 += diff - meanDifference;
         }
         return (sum1 - (sum2 * sum2 / n)) / (n - 1);
-    }      
-    
-}
\ No newline at end of file
+    }
+
+}

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/Clusterable.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/Clusterable.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/Clusterable.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/clustering/Clusterable.java Sat Sep  5 17:36:48 2009
@@ -29,7 +29,7 @@
 
     /**
      * Returns the distance from the given point.
-     * 
+     *
      * @param p the point to compute the distance from
      * @return the distance from the given point
      */
@@ -37,7 +37,7 @@
 
     /**
      * Returns the centroid of the given Collection of points.
-     * 
+     *
      * @param p the Collection of points to compute the centroid of
      * @return the centroid of the given Collection of Points
      */

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=811685&r1=811684&r2=811685&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 Sat Sep  5 17:36:48 2009
@@ -43,7 +43,7 @@
 
     /**
      * Runs the K-means++ clustering algorithm.
-     * 
+     *
      * @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
@@ -57,7 +57,7 @@
         assignPointsToClusters(clusters, points);
 
         // iterate through updating the centers until we're done
-        final int max = (maxIterations < 0) ? Integer.MAX_VALUE : maxIterations; 
+        final int max = (maxIterations < 0) ? Integer.MAX_VALUE : maxIterations;
         for (int count = 0; count < max; count++) {
             boolean clusteringChanged = false;
             List<Cluster<T>> newClusters = new ArrayList<Cluster<T>>();
@@ -79,7 +79,7 @@
 
     /**
      * Adds the given points to the closest {@link Cluster}.
-     * 
+     *
      * @param <T> type of the points to cluster
      * @param clusters the {@link Cluster}s to add the points to
      * @param points the points to add to the given {@link Cluster}s
@@ -94,7 +94,7 @@
 
     /**
      * Use K-means++ to choose the initial centers.
-     * 
+     *
      * @param <T> type of the points to cluster
      * @param points the points to choose the initial centers from
      * @param k the number of centers to choose
@@ -113,7 +113,7 @@
 
         final double[] dx2 = new double[pointSet.size()];
         while (resultSet.size() < k) {
-            // For each data point x, compute D(x), the distance between x and 
+            // For each data point x, compute D(x), the distance between x and
             // the nearest center that has already been chosen.
             int sum = 0;
             for (int i = 0; i < pointSet.size(); i++) {
@@ -142,7 +142,7 @@
 
     /**
      * Returns the nearest {@link Cluster} to the given point
-     * 
+     *
      * @param <T> type of the points to cluster
      * @param clusters the {@link Cluster}s to search
      * @param point the point to find the nearest {@link Cluster} for

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/Covariance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/Covariance.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/Covariance.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/Covariance.java Sat Sep  5 17:36:48 2009
@@ -24,26 +24,26 @@
 
 /**
  * Computes covariances for pairs of arrays or columns of a matrix.
- * 
- * <p>The constructors that take <code>RealMatrix</code> or 
+ *
+ * <p>The constructors that take <code>RealMatrix</code> or
  * <code>double[][]</code> arguments generate covariance matrices.  The
  * columns of the input matrices are assumed to represent variable values.</p>
- * 
+ *
  * <p>The constructor argument <code>biasCorrected</code> determines whether or
  * not computed covariances are bias-corrected.</p>
- * 
+ *
  * <p>Unbiased covariances are given by the formula</p>
  * <code>cov(X, Y) = &Sigma;[(x<sub>i</sub> - E(X))(y<sub>i</sub> - E(Y))] / (n - 1)</code>
  * where <code>E(X)</code> is the mean of <code>X</code> and <code>E(Y)</code>
  * is the mean of the <code>Y</code> values.
- * 
+ *
  * <p>Non-bias-corrected estimates use <code>n</code> in place of <code>n - 1</code>
- * 
+ *
  * @version $Revision$ $Date$
  * @since 2.0
  */
 public class Covariance {
-    
+
     /** covariance matrix */
     private final RealMatrix covarianceMatrix;
 
@@ -52,8 +52,8 @@
      */
     /** Number of observations (length of covariate vectors) */
     private final int n;
-    
-    /** 
+
+    /**
      * Create a Covariance with no data
      */
     public Covariance() {
@@ -61,17 +61,17 @@
         covarianceMatrix = null;
         n = 0;
     }
-    
+
     /**
      * Create a Covariance matrix from a rectangular array
      * whose columns represent covariates.
-     * 
+     *
      * <p>The <code>biasCorrected</code> parameter determines whether or not
      * covariance estimates are bias-corrected.</p>
-     * 
+     *
      * <p>The input array must be rectangular with at least two columns
      * and two rows.</p>
-     * 
+     *
      * @param data rectangular array with columns representing covariates
      * @param biasCorrected true means covariances are bias-corrected
      * @throws IllegalArgumentException if the input data array is not
@@ -80,14 +80,14 @@
     public Covariance(double[][] data, boolean biasCorrected) {
         this(new BlockRealMatrix(data), biasCorrected);
     }
-    
+
     /**
      * Create a Covariance matrix from a rectangular array
      * whose columns represent covariates.
-     * 
+     *
      * <p>The input array must be rectangular with at least two columns
      * and two rows</p>
-     * 
+     *
      * @param data rectangular array with columns representing covariates
      * @throws IllegalArgumentException if the input data array is not
      * rectangular with at least two rows and two columns.
@@ -95,16 +95,16 @@
     public Covariance(double[][] data) {
         this(data, true);
     }
-    
+
     /**
      * Create a covariance matrix from a matrix whose columns
      * represent covariates.
-     * 
+     *
      * <p>The <code>biasCorrected</code> parameter determines whether or not
      * covariance estimates are bias-corrected.</p>
-     * 
+     *
      * <p>The matrix must have at least two columns and two rows</p>
-     * 
+     *
      * @param matrix matrix with columns representing covariates
      * @param biasCorrected true means covariances are bias-corrected
      * @throws IllegalArgumentException if the input matrix does not have
@@ -115,13 +115,13 @@
        n = matrix.getRowDimension();
        covarianceMatrix = computeCovarianceMatrix(matrix, biasCorrected);
     }
-    
+
     /**
      * Create a covariance matrix from a matrix whose columns
      * represent covariates.
-     * 
+     *
      * <p>The matrix must have at least two columns and two rows</p>
-     * 
+     *
      * @param matrix matrix with columns representing covariates
      * @throws IllegalArgumentException if the input matrix does not have
      * at least two rows and two columns
@@ -129,26 +129,26 @@
     public Covariance(RealMatrix matrix) {
         this(matrix, true);
     }
-    
+
     /**
      * Returns the covariance matrix
-     * 
+     *
      * @return covariance matrix
      */
     public RealMatrix getCovarianceMatrix() {
         return covarianceMatrix;
     }
-    
+
     /**
      * Returns the number of observations (length of covariate vectors)
-     * 
+     *
      * @return number of observations
      */
-    
+
     public int getN() {
         return n;
     }
-    
+
     /**
      * Compute a covariance matrix from a matrix whose columns represent
      * covariates.
@@ -170,7 +170,7 @@
         }
         return outMatrix;
     }
-    
+
     /**
      * Create a covariance matrix from a matrix whose columns represent
      * covariates. Covariances are computed using the bias-corrected formula.
@@ -181,7 +181,7 @@
     protected RealMatrix computeCovarianceMatrix(RealMatrix matrix) {
         return computeCovarianceMatrix(matrix, true);
     }
-    
+
     /**
      * Compute a covariance matrix from a rectangular array whose columns represent
      * covariates.
@@ -192,7 +192,7 @@
     protected RealMatrix computeCovarianceMatrix(double[][] data, boolean biasCorrected) {
         return computeCovarianceMatrix(new BlockRealMatrix(data), biasCorrected);
     }
-    
+
     /**
      * Create a covariance matrix from a rectangual array whose columns represent
      * covariates. Covariances are computed using the bias-corrected formula.
@@ -203,20 +203,20 @@
     protected RealMatrix computeCovarianceMatrix(double[][] data) {
         return computeCovarianceMatrix(data, true);
     }
-    
+
     /**
      * Computes the covariance between the two arrays.
-     * 
+     *
      * <p>Array lengths must match and the common length must be at least 2.</p>
      *
      * @param xArray first data array
      * @param yArray second data array
-     * @param biasCorrected if true, returned value will be bias-corrected 
-     * @return returns the covariance for the two arrays 
+     * @param biasCorrected if true, returned value will be bias-corrected
+     * @return returns the covariance for the two arrays
      * @throws  IllegalArgumentException if the arrays lengths do not match or
      * there is insufficient data
      */
-    public double covariance(final double[] xArray, final double[] yArray, boolean biasCorrected) 
+    public double covariance(final double[] xArray, final double[] yArray, boolean biasCorrected)
         throws IllegalArgumentException {
         Mean mean = new Mean();
         double result = 0d;
@@ -238,24 +238,24 @@
         }
         return biasCorrected ? result * ((double) length / (double)(length - 1)) : result;
     }
-    
+
     /**
      * Computes the covariance between the two arrays, using the bias-corrected
      * formula.
-     * 
+     *
      * <p>Array lengths must match and the common length must be at least 2.</p>
      *
      * @param xArray first data array
      * @param yArray second data array
-     * @return returns the covariance for the two arrays 
+     * @return returns the covariance for the two arrays
      * @throws  IllegalArgumentException if the arrays lengths do not match or
      * there is insufficient data
      */
-    public double covariance(final double[] xArray, final double[] yArray) 
+    public double covariance(final double[] xArray, final double[] yArray)
         throws IllegalArgumentException {
         return covariance(xArray, yArray, true);
     }
-    
+
     /**
      * Throws IllegalArgumentException of the matrix does not have at least
      * two columns and two rows

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java Sat Sep  5 17:36:48 2009
@@ -27,26 +27,26 @@
 /**
  * Computes Pearson's product-moment correlation coefficients for pairs of arrays
  * or columns of a matrix.
- * 
- * <p>The constructors that take <code>RealMatrix</code> or 
+ *
+ * <p>The constructors that take <code>RealMatrix</code> or
  * <code>double[][]</code> arguments generate correlation matrices.  The
  * columns of the input matrices are assumed to represent variable values.
  * Correlations are given by the formula</p>
  * <code>cor(X, Y) = &Sigma;[(x<sub>i</sub> - E(X))(y<sub>i</sub> - E(Y))] / [(n - 1)s(X)s(Y)]</code>
  * where <code>E(X)</code> is the mean of <code>X</code>, <code>E(Y)</code>
  * is the mean of the <code>Y</code> values and s(X), s(Y) are standard deviations.
- * 
+ *
  * @version $Revision$ $Date$
  * @since 2.0
  */
 public class PearsonsCorrelation {
-    
+
     /** correlation matrix */
     private final RealMatrix correlationMatrix;
-    
+
     /** number of observations */
     private final int nObs;
-    
+
     /**
      * Create a PearsonsCorrelation instance without data
      */
@@ -55,11 +55,11 @@
         correlationMatrix = null;
         nObs = 0;
     }
-    
+
     /**
      * Create a PearsonsCorrelation from a rectangular array
      * whose columns represent values of variables to be correlated.
-     * 
+     *
      * @param data rectangular array with columns representing variables
      * @throws IllegalArgumentException if the input data array is not
      * rectangular with at least two rows and two columns.
@@ -67,11 +67,11 @@
     public PearsonsCorrelation(double[][] data) {
         this(new BlockRealMatrix(data));
     }
-    
+
     /**
      * Create a PearsonsCorrelation from a RealMatrix whose columns
      * represent variables to be correlated.
-     * 
+     *
      * @param matrix matrix with columns representing variables to correlate
      */
     public PearsonsCorrelation(RealMatrix matrix) {
@@ -79,13 +79,13 @@
         nObs = matrix.getRowDimension();
         correlationMatrix = computeCorrelationMatrix(matrix);
     }
-    
+
     /**
      * Create a PearsonsCorrelation from a {@link Covariance}.  The correlation
      * matrix is computed by scaling the Covariance's covariance matrix.
      * The Covariance instance must have been created from a data matrix with
      * columns representing variable values.
-     * 
+     *
      * @param covariance Covariance instance
      */
     public PearsonsCorrelation(Covariance covariance) {
@@ -96,11 +96,11 @@
         nObs = covariance.getN();
         correlationMatrix = covarianceToCorrelation(covarianceMatrix);
     }
-    
+
     /**
      * Create a PearsonsCorrelation from a covariance matrix.  The correlation
      * matrix is computed by scaling the covariance matrix.
-     * 
+     *
      * @param covarianceMatrix covariance matrix
      * @param numberOfObservations the number of observations in the dataset used to compute
      * the covariance matrix
@@ -108,18 +108,18 @@
     public PearsonsCorrelation(RealMatrix covarianceMatrix, int numberOfObservations) {
         nObs = numberOfObservations;
         correlationMatrix = covarianceToCorrelation(covarianceMatrix);
-        
+
     }
-    
+
     /**
      * Returns the correlation matrix
-     * 
+     *
      * @return correlation matrix
      */
     public RealMatrix getCorrelationMatrix() {
-        return correlationMatrix;  
+        return correlationMatrix;
     }
-    
+
     /**
      * Returns a matrix of standard errors associated with the estimates
      * in the correlation matrix.<br/>
@@ -127,9 +127,9 @@
      * error associated with <code>getCorrelationMatrix.getEntry(i,j)</code>
      * <p>The formula used to compute the standard error is <br/>
      * <code>SE<sub>r</sub> = ((1 - r<sup>2</sup>) / (n - 2))<sup>1/2</sup></code>
-     * where <code>r</code> is the estimated correlation coefficient and 
+     * where <code>r</code> is the estimated correlation coefficient and
      * <code>n</code> is the number of observations in the source dataset.</p>
-     * 
+     *
      * @return matrix of correlation standard errors
      */
     public RealMatrix getCorrelationStandardErrors() {
@@ -151,9 +151,9 @@
      * that a random variable distributed as <code>t<sub>n-2</sub></code> takes
      * a value with absolute value greater than or equal to <br>
      * <code>|r|((n - 2) / (1 - r<sup>2</sup>))<sup>1/2</sup></code></p>
-     * <p>The values in the matrix are sometimes referred to as the 
+     * <p>The values in the matrix are sometimes referred to as the
      * <i>significance</i> of the corresponding correlation coefficients.</p>
-     * 
+     *
      * @return matrix of p-values
      * @throws MathException if an error occurs estimating probabilities
      */
@@ -174,12 +174,12 @@
         }
         return new BlockRealMatrix(out);
     }
-    
-    
+
+
     /**
      * Computes the correlation matrix for the columns of the
      * input matrix.
-     * 
+     *
      * @param matrix matrix with columns representing variables to correlate
      * @return correlation matrix
      */
@@ -196,28 +196,28 @@
         }
         return outMatrix;
     }
-    
+
     /**
      * Computes the correlation matrix for the columns of the
      * input rectangular array.  The colums of the array represent values
      * of variables to be correlated.
-     * 
+     *
      * @param data matrix with columns representing variables to correlate
      * @return correlation matrix
      */
     public RealMatrix computeCorrelationMatrix(double[][] data) {
        return computeCorrelationMatrix(new BlockRealMatrix(data));
     }
-    
+
     /**
      * Computes the Pearson's product-moment correlation coefficient between the two arrays.
-     * 
+     *
      * </p>Throws IllegalArgumentException if the arrays do not have the same length
      * or their common length is less than 2</p>
      *
      * @param xArray first data array
      * @param yArray second data array
-     * @return Returns Pearson's correlation coefficient for the two arrays 
+     * @return Returns Pearson's correlation coefficient for the two arrays
      * @throws  IllegalArgumentException if the arrays lengths do not match or
      * there is insufficient data
      */
@@ -235,15 +235,15 @@
                     xArray.length, yArray.length);
         }
     }
-    
+
     /**
      * Derives a correlation matrix from a covariance matrix.
-     * 
+     *
      * <p>Uses the formula <br/>
-     * <code>r(X,Y) = cov(X,Y)/s(X)s(Y)</code> where 
+     * <code>r(X,Y) = cov(X,Y)/s(X)s(Y)</code> where
      * <code>r(&middot,&middot;)</code> is the correlation coefficient and
      * <code>s(&middot;)</code> means standard deviation.</p>
-     * 
+     *
      * @param covarianceMatrix the covariance matrix
      * @return correlation matrix
      */
@@ -254,7 +254,7 @@
             double sigma = Math.sqrt(covarianceMatrix.getEntry(i, i));
             outMatrix.setEntry(i, i, 1d);
             for (int j = 0; j < i; j++) {
-                double entry = covarianceMatrix.getEntry(i, j) / 
+                double entry = covarianceMatrix.getEntry(i, j) /
                        (sigma * Math.sqrt(covarianceMatrix.getEntry(j, j)));
                 outMatrix.setEntry(i, j, entry);
                 outMatrix.setEntry(j, i, entry);
@@ -262,11 +262,11 @@
         }
         return outMatrix;
     }
-    
+
     /**
      * Throws IllegalArgumentException of the matrix does not have at least
      * two columns and two rows
-     * 
+     *
      * @param matrix matrix to check for sufficiency
      */
     private void checkSufficientData(final RealMatrix matrix) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java Sat Sep  5 17:36:48 2009
@@ -27,89 +27,89 @@
  * <p>Spearman's rank correlation. This implementation performs a rank
  * transformation on the input data and then computes {@link PearsonsCorrelation}
  * on the ranked data.</p>
- * 
+ *
  * <p>By default, ranks are computed using {@link NaturalRanking} with default
  * strategies for handling NaNs and ties in the data (NaNs maximal, ties averaged).
  * The ranking algorithm can be set using a constructor argument.</p>
- * 
+ *
  * @since 2.0
  * @version $Revision$ $Date$
  */
 
-public class SpearmansCorrelation {   
-   
+public class SpearmansCorrelation {
+
     /** Input data */
     private final RealMatrix data;
-    
+
     /** Ranking algorithm  */
     private final RankingAlgorithm rankingAlgorithm;
-    
+
     /** Rank correlation */
     private final PearsonsCorrelation rankCorrelation;
-    
+
     /**
      * Create a SpearmansCorrelation with the given input data matrix
      * and ranking algorithm.
-     * 
+     *
      * @param dataMatrix matrix of data with columns representing
      * variables to correlate
      * @param rankingAlgorithm ranking algorithm
-     */    
+     */
     public SpearmansCorrelation(final RealMatrix dataMatrix, final RankingAlgorithm rankingAlgorithm) {
-        this.data = dataMatrix.copy(); 
+        this.data = dataMatrix.copy();
         this.rankingAlgorithm = rankingAlgorithm;
         rankTransform(data);
         rankCorrelation = new PearsonsCorrelation(data);
     }
-    
+
     /**
      * Create a SpearmansCorrelation from the given data matrix.
-     * 
+     *
      * @param dataMatrix matrix of data with columns representing
      * variables to correlate
      */
     public SpearmansCorrelation(final RealMatrix dataMatrix) {
         this(dataMatrix, new NaturalRanking());
     }
-    
+
     /**
      * Create a SpearmansCorrelation without data.
      */
     public SpearmansCorrelation() {
-        data = null; 
+        data = null;
         this.rankingAlgorithm = new NaturalRanking();
         rankCorrelation = null;
     }
-    
+
     /**
-     * Calculate the Spearman Rank Correlation Matrix. 
-     * 
+     * Calculate the Spearman Rank Correlation Matrix.
+     *
      * @return Spearman Rank Correlation Matrix
      */
     public RealMatrix getCorrelationMatrix() {
         return rankCorrelation.getCorrelationMatrix();
     }
-    
+
     /**
      * Returns a {@link PearsonsCorrelation} instance constructed from the
      * ranked input data. That is,
      * <code>new SpearmansCorrelation(matrix).getRankCorrelation()</code>
-     * is equivalent to 
+     * is equivalent to
      * <code>new PearsonsCorrelation(rankTransform(matrix))</code> where
      * <code>rankTransform(matrix)</code> is the result of applying the
      * configured <code>RankingAlgorithm</code> to each of the columns of
      * <code>matrix.</code>
-     * 
+     *
      * @return PearsonsCorrelation among ranked column data
      */
     public PearsonsCorrelation getRankCorrelation() {
         return rankCorrelation;
     }
-    
+
     /**
      * Computes the Spearman's rank correlation matrix for the columns of the
      * input matrix.
-     * 
+     *
      * @param matrix matrix with columns representing variables to correlate
      * @return correlation matrix
      */
@@ -118,28 +118,28 @@
         rankTransform(matrixCopy);
         return new PearsonsCorrelation().computeCorrelationMatrix(matrixCopy);
     }
-    
+
     /**
      * Computes the Spearman's rank correlation matrix for the columns of the
      * input rectangular array.  The columns of the array represent values
      * of variables to be correlated.
-     * 
+     *
      * @param matrix matrix with columns representing variables to correlate
      * @return correlation matrix
      */
     public RealMatrix computeCorrelationMatrix(double[][] matrix) {
        return computeCorrelationMatrix(new BlockRealMatrix(matrix));
     }
-    
+
     /**
      * Computes the Spearman's rank correlation coefficient between the two arrays.
-     * 
+     *
      * </p>Throws IllegalArgumentException if the arrays do not have the same length
      * or their common length is less than 2</p>
      *
      * @param xArray first data array
      * @param yArray second data array
-     * @return Returns Spearman's rank correlation coefficient for the two arrays 
+     * @return Returns Spearman's rank correlation coefficient for the two arrays
      * @throws  IllegalArgumentException if the arrays lengths do not match or
      * there is insufficient data
      */
@@ -155,11 +155,11 @@
                     xArray.length, yArray.length);
         }
     }
-    
+
     /**
      * Applies rank transform to each of the columns of <code>matrix</code>
      * using the current <code>rankingAlgorithm</code>
-     * 
+     *
      * @param matrix matrix to transform
      */
     private void rankTransform(RealMatrix matrix) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java Sat Sep  5 17:36:48 2009
@@ -33,11 +33,11 @@
 public abstract class AbstractStorelessUnivariateStatistic
     extends AbstractUnivariateStatistic
     implements StorelessUnivariateStatistic {
-    
+
     /**
-     * This default implementation calls {@link #clear}, then invokes 
-     * {@link #increment} in a loop over the the input array, and then uses 
-     * {@link #getResult} to compute the return value.  
+     * This default implementation calls {@link #clear}, then invokes
+     * {@link #increment} in a loop over the the input array, and then uses
+     * {@link #getResult} to compute the return value.
      * <p>
      * Note that this implementation changes the internal state of the
      * statistic.  Its side effects are the same as invoking {@link #clear} and
@@ -59,11 +59,11 @@
         }
         return evaluate(values, 0, values.length);
     }
-    
+
     /**
-     * This default implementation calls {@link #clear}, then invokes 
-     * {@link #increment} in a loop over the specified portion of the input 
-     * array, and then uses {@link #getResult} to compute the return value.  
+     * This default implementation calls {@link #clear}, then invokes
+     * {@link #increment} in a loop over the specified portion of the input
+     * array, and then uses {@link #getResult} to compute the return value.
      * <p>
      * Note that this implementation changes the internal state of the
      * statistic.  Its side effects are the same as invoking {@link #clear} and
@@ -73,7 +73,7 @@
      * possibly more accurate implementation that works directly with the
      * input array.</p>
      * <p>
-     * If the array is null or the index parameters are not valid, an 
+     * If the array is null or the index parameters are not valid, an
      * IllegalArgumentException is thrown.</p>
      * @param values the input array
      * @param begin the index of the first element to include
@@ -110,13 +110,13 @@
      * {@inheritDoc}
      */
     public abstract void increment(final double d);
-    
+
     /**
      * This default implementation just calls {@link #increment} in a loop over
-     * the input array.   
+     * the input array.
      * <p>
      * Throws IllegalArgumentException if the input values array is null.</p>
-     * 
+     *
      * @param values values to add
      * @throws IllegalArgumentException if values is null
      * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[])
@@ -126,14 +126,14 @@
             throw MathRuntimeException.createIllegalArgumentException("input values array is null");
         }
         incrementAll(values, 0, values.length);
-    } 
-   
+    }
+
     /**
      * This default implementation just calls {@link #increment} in a loop over
      * the specified portion of the input array.
      * <p>
      * Throws IllegalArgumentException if the input values array is null.</p>
-     * 
+     *
      * @param values  array holding values to add
      * @param begin   index of the first array element to add
      * @param length  number of array elements to add
@@ -145,12 +145,12 @@
             int k = begin + length;
             for (int i = begin; i < k; i++) {
                 increment(values[i]);
-            }   
+            }
         }
     }
-    
+
     /**
-     * Returns true iff <code>object</code> is an 
+     * Returns true iff <code>object</code> is an
      * <code>AbstractStorelessUnivariateStatistic</code> returning the same
      * values as this for <code>getResult()</code> and <code>getN()</code>
      * @param object object to test equality against.
@@ -165,13 +165,13 @@
             return false;
         }
         AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object;
-        return (MathUtils.equals(stat.getResult(), this.getResult()) && 
+        return (MathUtils.equals(stat.getResult(), this.getResult()) &&
                 MathUtils.equals(stat.getN(), this.getN()));
     }
-    
+
     /**
      * Returns hash code based on getResult() and getN()
-     * 
+     *
      * @return hash code
      */
     @Override
@@ -179,4 +179,4 @@
         return 31* (31 + MathUtils.hash(getResult())) + MathUtils.hash(getN());
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java Sat Sep  5 17:36:48 2009
@@ -19,16 +19,16 @@
 import org.apache.commons.math.MathRuntimeException;
 
 /**
- * Abstract base class for all implementations of the 
+ * Abstract base class for all implementations of the
  * {@link UnivariateStatistic} interface.
  * <p>
- * Provides a default implementation of <code>evaluate(double[]),</code> 
+ * Provides a default implementation of <code>evaluate(double[]),</code>
  * delegating to <code>evaluate(double[], int, int)</code> in the natural way.
  * </p>
  * <p>
  * Also includes a <code>test</code> method that performs generic parameter
  * validation for the <code>evaluate</code> methods.</p>
- * 
+ *
  * @version $Revision$ $Date$
  */
 public abstract class AbstractUnivariateStatistic
@@ -164,7 +164,7 @@
                 containsPositiveWeight = true;
             }
         }
-        
+
         if (!containsPositiveWeight) {
             throw MathRuntimeException.createIllegalArgumentException(
                     "weight array must contain at least one non-zero value");

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java Sat Sep  5 17:36:48 2009
@@ -39,7 +39,7 @@
  * aggregate statistics directly from a Collection of SummaryStatistics instances.
  * </p><p>
  * When {@link #createContributingStatistics()} is used to create SummaryStatistics
- * instances to be aggregated concurrently, the created instances' 
+ * instances to be aggregated concurrently, the created instances'
  * {@link SummaryStatistics#addValue(double)} methods must synchronize on the aggregating
  * instance maintained by this class.  In multithreaded environments, if the functionality
  * provided by {@link #aggregate(Collection)} is adequate, that method should be used
@@ -47,35 +47,35 @@
  *
  * @since 2.0
  * @version $Revision$ $Date$
- * 
+ *
  */
 public class AggregateSummaryStatistics implements StatisticalSummary,
         Serializable {
 
- 
+
     /** Serializable version identifier */
     private static final long serialVersionUID = -8207112444016386906L;
 
     /**
      * A SummaryStatistics serving as a prototype for creating SummaryStatistics
-     * contributing to this aggregate 
+     * contributing to this aggregate
      */
     private final SummaryStatistics statisticsPrototype;
-    
+
     /**
      * The SummaryStatistics in which aggregate statistics are accumulated.
      */
     private final SummaryStatistics statistics;
-    
+
     /**
      * Initializes a new AggregateSummaryStatistics with default statistics
      * implementations.
-     * 
+     *
      */
     public AggregateSummaryStatistics() {
         this(new SummaryStatistics());
     }
-    
+
     /**
      * Initializes a new AggregateSummaryStatistics with the specified statistics
      * object as a prototype for contributing statistics and for the internal
@@ -86,7 +86,7 @@
      *      prototype both for the internal aggregate statistics and for
      *      contributing statistics obtained via the
      *      {@code createContributingStatistics()} method.  Being a prototype
-     *      means that other objects are initialized by copying this object's state. 
+     *      means that other objects are initialized by copying this object's state.
      *      If {@code null}, a new, default statistics object is used.  Any statistic
      *      values in the prototype are propagated to contributing statistics
      *      objects and (once) into these aggregate statistics.
@@ -96,7 +96,7 @@
         this(prototypeStatistics, (prototypeStatistics == null ? null :
                 new SummaryStatistics(prototypeStatistics)));
     }
-    
+
     /**
      * Initializes a new AggregateSummaryStatistics with the specified statistics
      * object as a prototype for contributing statistics and for the internal
@@ -108,7 +108,7 @@
      *      prototype both for the internal aggregate statistics and for
      *      contributing statistics obtained via the
      *      {@code createContributingStatistics()} method.  Being a prototype
-     *      means that other objects are initialized by copying this object's state. 
+     *      means that other objects are initialized by copying this object's state.
      *      If {@code null}, a new, default statistics object is used.  Any statistic
      *      values in the prototype are propagated to contributing statistics
      *      objects, but not into these aggregate statistics.
@@ -124,7 +124,7 @@
         this.statistics = ((initialStatistics == null) ?
                 new SummaryStatistics() : initialStatistics);
     }
-    
+
     /**
      * {@inheritDoc}.  This version returns the maximum over all the aggregated
      * data.
@@ -205,10 +205,10 @@
             return statistics.getVariance();
         }
     }
-    
+
     /**
      * Returns the sum of the logs of all the aggregated data.
-     * 
+     *
      * @return the sum of logs
      * @see SummaryStatistics#getSumOfLogs()
      */
@@ -217,10 +217,10 @@
             return statistics.getSumOfLogs();
         }
     }
-    
+
     /**
      * Returns the geometric mean of all the aggregated data.
-     * 
+     *
      * @return the geometric mean
      * @see SummaryStatistics#getGeometricMean()
      */
@@ -229,10 +229,10 @@
             return statistics.getGeometricMean();
         }
     }
-    
+
     /**
      * Returns the sum of the squares of all the aggregated data.
-     * 
+     *
      * @return The sum of squares
      * @see SummaryStatistics#getSumsq()
      */
@@ -241,12 +241,12 @@
             return statistics.getSumsq();
         }
     }
-    
+
     /**
      * Returns a statistic related to the Second Central Moment.  Specifically,
      * what is returned is the sum of squared deviations from the sample mean
      * among the all of the aggregated data.
-     * 
+     *
      * @return second central moment statistic
      * @see SummaryStatistics#getSecondMoment()
      */
@@ -255,23 +255,23 @@
             return statistics.getSecondMoment();
         }
     }
-    
+
     /**
      * Return a {@link StatisticalSummaryValues} instance reporting current
      * aggregate statistics.
-     * 
+     *
      * @return Current values of aggregate statistics
      */
     public StatisticalSummary getSummary() {
         synchronized (statistics) {
-            return new StatisticalSummaryValues(getMean(), getVariance(), getN(), 
+            return new StatisticalSummaryValues(getMean(), getVariance(), getN(),
                     getMax(), getMin(), getSum());
         }
     }
 
     /**
      * Creates and returns a {@code SummaryStatistics} whose data will be
-     * aggregated with those of this {@code AggregateSummaryStatistics}. 
+     * aggregated with those of this {@code AggregateSummaryStatistics}.
      *
      * @return a {@code SummaryStatistics} whose data will be aggregated with
      *      those of this {@code AggregateSummaryStatistics}.  The initial state
@@ -280,12 +280,12 @@
     public SummaryStatistics createContributingStatistics() {
         SummaryStatistics contributingStatistics
                 = new AggregatingSummaryStatistics(statistics);
-        
+
         SummaryStatistics.copy(statisticsPrototype, contributingStatistics);
-        
+
         return contributingStatistics;
     }
-    
+
     /**
      * Computes aggregate summary statistics. This method can be used to combine statistics
      * computed over partitions or subsamples - i.e., the StatisticalSummaryValues returned
@@ -294,7 +294,7 @@
      * <p>
      * Returns null if the collection is empty or null.
      * </p>
-     * 
+     *
      * @param statistics collection of SummaryStatistics to aggregate
      * @return summary statistics for the combined dataset
      */
@@ -327,7 +327,7 @@
             n += curN;
             final double meanDiff = current.getMean() - mean;
             mean = sum / n;
-            m2 = m2 + current.getSecondMoment() + meanDiff * meanDiff * oldN * curN / n; 
+            m2 = m2 + current.getSecondMoment() + meanDiff * meanDiff * oldN * curN / n;
         }
         final double variance;
         if (n == 0) {
@@ -339,7 +339,7 @@
         }
         return new StatisticalSummaryValues(mean, variance, n, max, min, sum);
     }
-    
+
     /**
      * A SummaryStatistics that also forwards all values added to it to a second
      * {@code SummaryStatistics} for aggregation.
@@ -347,18 +347,18 @@
      * @since 2.0
      */
     private static class AggregatingSummaryStatistics extends SummaryStatistics {
-        
+
         /**
          * The serialization version of this class
          */
         private static final long serialVersionUID = 1L;
-        
+
         /**
          * An additional SummaryStatistics into which values added to these
          * statistics (and possibly others) are aggregated
          */
         private final SummaryStatistics aggregateStatistics;
-        
+
         /**
          * Initializes a new AggregatingSummaryStatistics with the specified
          * aggregate statistics object