psteitz     2004/01/26 18:43:44

  Modified:    math/src/java/org/apache/commons/math/stat
                        SummaryStatisticsImpl.java
  Log:
  Eliminated unecessary first moment computations.
  
  Revision  Changes    Path
  1.2       +3 -9      
jakarta-commons/math/src/java/org/apache/commons/math/stat/SummaryStatisticsImpl.java
  
  Index: SummaryStatisticsImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/SummaryStatisticsImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SummaryStatisticsImpl.java        25 Jan 2004 21:30:41 -0000      1.1
  +++ SummaryStatisticsImpl.java        27 Jan 2004 02:43:44 -0000      1.2
  @@ -73,11 +73,8 @@
   
       /** count of values that have been added */
       protected long n = 0;
  -
  -    /** FirstMoment is used to compute the mean */
  -    protected FirstMoment firstMoment = null;
       
  -    /** SecondMoment is used to compute the variance */
  +    /** SecondMoment is used to compute the mean and variance */
       protected SecondMoment secondMoment = null;
       
       /** sum of values that have been added */
  @@ -115,7 +112,6 @@
           sumLog = new SumOfLogs();
           geoMean = new GeometricMean();
           secondMoment = new SecondMoment();
  -        firstMoment = new FirstMoment();
       }
   
       /**
  @@ -130,7 +126,6 @@
        max.increment(value);
        sumLog.increment(value);
        geoMean.increment(value);
  -     firstMoment.increment(value);
        secondMoment.increment(value);
        n++;
       }
  @@ -168,7 +163,7 @@
        * @return the mean
        */
       public double getMean() {
  -      return new Mean(firstMoment).getResult();
  +      return new Mean(secondMoment).getResult();
       }
   
       /**
  @@ -262,7 +257,6 @@
           sumLog.clear();
           sumsq.clear();
           geoMean.clear();
  -        firstMoment.clear();
           secondMoment.clear();
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to