Added constructor.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-07-18 05:39:30 +00:00
parent 2893f9bfdd
commit 5bc7adf6b2
10 changed files with 116 additions and 34 deletions

View File

@ -42,7 +42,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.19 $ $Date: 2004/07/10 17:09:08 $
* @version $Revision: 1.20 $ $Date: 2004/07/18 05:39:30 $
*/
public class FirstMoment extends AbstractStorelessUnivariateStatistic
implements Serializable {
@ -51,24 +51,34 @@ public class FirstMoment extends AbstractStorelessUnivariateStatistic
static final long serialVersionUID = -803343206421984070L;
/** Count of values that have been added */
protected long n = 0;
protected long n;
/** First moment of values that have been added */
protected double m1 = Double.NaN;
protected double m1;
/**
* Deviation of most recently added value from previous first moment.
* Retained to prevent repeated computation in higher order moments.
*/
protected double dev = Double.NaN;
protected double dev;
/**
* Deviation of most recently added value from previous first moment,
* normalized by previous sample size. Retained to prevent repeated
* computation in higher order moments
*/
protected double nDev = Double.NaN;
protected double nDev;
/**
* Create a FirstMoment instance
*/
public FirstMoment() {
n = 0;
m1 = Double.NaN;
dev = Double.NaN;
nDev = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/
@ -106,5 +116,4 @@ public class FirstMoment extends AbstractStorelessUnivariateStatistic
public long getN() {
return n;
}
}

View File

@ -47,7 +47,7 @@ import java.io.Serializable;
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.20 $ $Date: 2004/07/04 09:02:36 $
* @version $Revision: 1.21 $ $Date: 2004/07/18 05:39:30 $
*/
public class FourthMoment extends ThirdMoment implements Serializable{
@ -55,8 +55,16 @@ public class FourthMoment extends ThirdMoment implements Serializable{
static final long serialVersionUID = 4763990447117157611L;
/** fourth moment of values that have been added */
protected double m4 = Double.NaN;
protected double m4;
/**
* Create a FourthMoment instance
*/
public FourthMoment() {
super();
m4 = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -39,7 +39,7 @@ import java.io.Serializable;
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.19 $ $Date: 2004/07/04 09:02:36 $
* @version $Revision: 1.20 $ $Date: 2004/07/18 05:39:30 $
*/
public class SecondMoment extends FirstMoment implements Serializable {
@ -47,8 +47,16 @@ public class SecondMoment extends FirstMoment implements Serializable {
static final long serialVersionUID = 3942403127395076445L;
/** second moment of values that have been added */
protected double m2 = Double.NaN;
protected double m2;
/**
* Create a SecondMoment instance
*/
public SecondMoment() {
super();
m2 = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -40,7 +40,7 @@ import java.io.Serializable;
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.19 $ $Date: 2004/07/04 09:02:36 $
* @version $Revision: 1.20 $ $Date: 2004/07/18 05:39:30 $
*/
public class ThirdMoment extends SecondMoment implements Serializable {
@ -48,15 +48,23 @@ public class ThirdMoment extends SecondMoment implements Serializable {
static final long serialVersionUID = -7818711964045118679L;
/** third moment of values that have been added */
protected double m3 = Double.NaN;
protected double m3;
/**
* Square of deviation of most recently added value from previous first
* moment, normalized by previous sample size. Retained to prevent
* repeated computation in higher order moments. nDevSq = nDev * nDev.
*/
protected double nDevSq = Double.NaN;
protected double nDevSq;
/**
* Create a FourthMoment instance
*/
public ThirdMoment() {
super();
m3 = Double.NaN;
nDevSq = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)

View File

@ -34,19 +34,27 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.21 $ $Date: 2004/07/11 18:39:08 $
* @version $Revision: 1.22 $ $Date: 2004/07/18 05:39:30 $
*/
public class Max extends AbstractStorelessUnivariateStatistic implements Serializable {
public class Max extends AbstractStorelessUnivariateStatistic {
/** Serializable version identifier */
static final long serialVersionUID = -5593383832225844641L;
/** Number of values that have been added */
private long n = 0;
private long n;
/** Current value of the statistic */
private double value = Double.NaN;
private double value;
/**
* Create a Max instance
*/
public Max() {
n = 0;
value = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -34,7 +34,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.22 $ $Date: 2004/07/11 18:39:08 $
* @version $Revision: 1.23 $ $Date: 2004/07/18 05:39:30 $
*/
public class Min extends AbstractStorelessUnivariateStatistic implements Serializable {
@ -42,11 +42,19 @@ public class Min extends AbstractStorelessUnivariateStatistic implements Seriali
static final long serialVersionUID = -2941995784909003131L;
/**Number of values that have been added */
private long n = 0;
private long n;
/**Current value of the statistic */
private double value = Double.NaN;
private double value;
/**
* Create a Min instance
*/
public Min() {
n = 0;
value = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -30,7 +30,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.21 $ $Date: 2004/07/10 17:09:08 $
* @version $Revision: 1.22 $ $Date: 2004/07/18 05:39:30 $
*/
public class Product extends AbstractStorelessUnivariateStatistic implements Serializable {
@ -38,13 +38,21 @@ public class Product extends AbstractStorelessUnivariateStatistic implements Ser
static final long serialVersionUID = 2824226005990582538L;
/**The number of values that have been added */
private long n = 0;
private long n;
/**
* The current Running Product.
*/
private double value = Double.NaN;
private double value;
/**
* Create a Product instance
*/
public Product() {
n = 0;
value = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -30,7 +30,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.24 $ $Date: 2004/07/10 17:09:08 $
* @version $Revision: 1.25 $ $Date: 2004/07/18 05:39:30 $
*/
public class Sum extends AbstractStorelessUnivariateStatistic implements Serializable {
@ -38,13 +38,21 @@ public class Sum extends AbstractStorelessUnivariateStatistic implements Seriali
static final long serialVersionUID = -8231831954703408316L;
/** */
private long n = 0;
private long n;
/**
* The currently running sum.
*/
private double value = Double.NaN;
private double value;
/**
* Create a Sum instance
*/
public Sum() {
n = 0;
value = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/

View File

@ -25,8 +25,9 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* Uses {@link java.lang.Math#log(double)} to compute the logs. Therefore,
* <ul>
* <li>If any of values are < 0, the result is <code>NaN.</code></li>
* <li>If all values are non-negative and less than <code>Double.POSITIVE_INFINITY</code>,
* but at least one value is 0, the result is <code>Double.NEGATIVE_INFINITY.</code></li>
* <li>If all values are non-negative and less than
* <code>Double.POSITIVE_INFINITY</code>, but at least one value is 0, the
* result is <code>Double.NEGATIVE_INFINITY.</code></li>
* <li>If both <code>Double.POSITIVE_INFINITY</code> and
* <code>Double.NEGATIVE_INFINITY</code> are among the values, the result is
* <code>NaN.</code></li>
@ -37,7 +38,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.21 $ $Date: 2004/07/10 17:09:08 $
* @version $Revision: 1.22 $ $Date: 2004/07/18 05:39:30 $
*/
public class SumOfLogs extends AbstractStorelessUnivariateStatistic implements Serializable {
@ -45,12 +46,20 @@ public class SumOfLogs extends AbstractStorelessUnivariateStatistic implements S
static final long serialVersionUID = -370076995648386763L;
/**Number of values that have been added */
private int n = 0;
private int n;
/**
* The currently running value
*/
private double value = 0d;
private double value;
/**
* Create a SumOfLogs instance
*/
public SumOfLogs() {
value = 0d;
n = 0;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)

View File

@ -30,7 +30,7 @@ import org .apache.commons.math.stat.univariate.AbstractStorelessUnivariateStati
* one of the threads invokes the <code>increment()</code> or
* <code>clear()</code> method, it must be synchronized externally.
*
* @version $Revision: 1.21 $ $Date: 2004/07/10 17:09:08 $
* @version $Revision: 1.22 $ $Date: 2004/07/18 05:39:30 $
*/
public class SumOfSquares extends AbstractStorelessUnivariateStatistic implements Serializable {
@ -38,13 +38,21 @@ public class SumOfSquares extends AbstractStorelessUnivariateStatistic implement
static final long serialVersionUID = 1460986908574398008L;
/** */
private long n = 0;
private long n;
/**
* The currently running sumSq
*/
private double value = Double.NaN;
private double value;
/**
* Create a SumOfSquares instance
*/
public SumOfSquares() {
n = 0;
value = Double.NaN;
}
/**
* @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
*/