public class StandardDeviation extends AbstractStorelessUnivariateStatistic implements Serializable
Variance instance.  The isBiasCorrected property of the
 wrapped Variance instance is exposed, so that this class can be used to
 compute both the "sample standard deviation" (the square root of the
 bias-corrected "sample variance") or the "population standard deviation"
 (the square root of the non-bias-corrected "population variance"). See
 Variance for more information.
 
 Note that this implementation is not synchronized. If
 multiple threads access an instance of this class concurrently, and at least
 one of the threads invokes the increment() or
 clear() method, it must be synchronized externally.
| Constructor and Description | 
|---|
| StandardDeviation()Constructs a StandardDeviation. | 
| StandardDeviation(boolean isBiasCorrected)Contructs a StandardDeviation with the specified value for the
  isBiasCorrectedproperty. | 
| StandardDeviation(boolean isBiasCorrected,
                 SecondMoment m2)Contructs a StandardDeviation with the specified value for the
  isBiasCorrectedproperty and the supplied external moment. | 
| StandardDeviation(SecondMoment m2)Constructs a StandardDeviation from an external second moment. | 
| StandardDeviation(StandardDeviation original)Copy constructor, creates a new  StandardDeviationidentical
 to theoriginal | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clear()Clears the internal state of the Statistic | 
| StandardDeviation | copy()Returns a copy of the statistic with the same internal state. | 
| static void | copy(StandardDeviation source,
    StandardDeviation dest)Copies source to dest. | 
| double | evaluate(double[] values)Returns the Standard Deviation of the entries in the input array, or
  Double.NaNif the array is empty. | 
| double | evaluate(double[] values,
        double mean)Returns the Standard Deviation of the entries in the input array, using
 the precomputed mean value. | 
| double | evaluate(double[] values,
        double mean,
        int begin,
        int length)Returns the Standard Deviation of the entries in the specified portion of
 the input array, using the precomputed mean value. | 
| double | evaluate(double[] values,
        int begin,
        int length)Returns the Standard Deviation of the entries in the specified portion of
 the input array, or  Double.NaNif the designated subarray
 is empty. | 
| long | getN()Returns the number of values that have been added. | 
| double | getResult()Returns the current value of the Statistic. | 
| void | increment(double d)Updates the internal state of the statistic to reflect the addition of the new value. | 
| boolean | isBiasCorrected() | 
| void | setBiasCorrected(boolean isBiasCorrected) | 
equals, hashCode, incrementAll, incrementAllevaluate, getData, getDataRef, setData, setData, test, test, test, testpublic StandardDeviation()
Variance
 instance's isBiasCorrected property to true.public StandardDeviation(SecondMoment m2)
m2 - the external momentpublic StandardDeviation(StandardDeviation original) throws NullArgumentException
StandardDeviation identical
 to the originaloriginal - the StandardDeviation instance to copyNullArgumentException - if original is nullpublic StandardDeviation(boolean isBiasCorrected)
isBiasCorrected property.  If this property is set to
 true, the Variance used in computing results will
 use the bias-corrected, or "sample" formula.  See Variance for
 details.isBiasCorrected - whether or not the variance computation will use
 the bias-corrected formulapublic StandardDeviation(boolean isBiasCorrected,
                 SecondMoment m2)
isBiasCorrected property and the supplied external moment.
 If isBiasCorrected is set to true, the
 Variance used in computing results will use the bias-corrected,
 or "sample" formula.  See Variance for details.isBiasCorrected - whether or not the variance computation will use
 the bias-corrected formulam2 - the external momentpublic void increment(double d)
increment in interface StorelessUnivariateStatisticincrement in class AbstractStorelessUnivariateStatisticd - the new value.public long getN()
getN in interface StorelessUnivariateStatisticpublic double getResult()
getResult in interface StorelessUnivariateStatisticgetResult in class AbstractStorelessUnivariateStatisticDouble.NaN if it
 has been cleared or just instantiated.public void clear()
clear in interface StorelessUnivariateStatisticclear in class AbstractStorelessUnivariateStatisticpublic double evaluate(double[] values)
                throws MathIllegalArgumentException
Double.NaN if the array is empty.
 Returns 0 for a single-value (i.e. length = 1) sample.
 Throws MathIllegalArgumentException if the array is null.
Does not change the internal state of the statistic.
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionevaluate in class AbstractStorelessUnivariateStatisticvalues - the input arrayMathIllegalArgumentException - if the array is nullUnivariateStatistic.evaluate(double[])public double evaluate(double[] values,
              int begin,
              int length)
                throws MathIllegalArgumentException
Double.NaN if the designated subarray
 is empty.
 Returns 0 for a single-value (i.e. length = 1) sample.
 Throws MathIllegalArgumentException if the array is null.
Does not change the internal state of the statistic.
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionevaluate in class AbstractStorelessUnivariateStatisticvalues - the input arraybegin - index of the first array element to includelength - the number of elements to includeMathIllegalArgumentException - if the array is null or the array index
  parameters are not validUnivariateStatistic.evaluate(double[], int, int)public double evaluate(double[] values,
              double mean,
              int begin,
              int length)
                throws MathIllegalArgumentException
Double.NaN if the designated subarray is empty.
 Returns 0 for a single-value (i.e. length = 1) sample.
The formula used assumes that the supplied mean value is the arithmetic mean of the sample data, not a known population parameter. This method is supplied only to save computation when the mean has already been computed.
 Throws IllegalArgumentException if the array is null.
Does not change the internal state of the statistic.
values - the input arraymean - the precomputed mean valuebegin - index of the first array element to includelength - the number of elements to includeMathIllegalArgumentException - if the array is null or the array index
  parameters are not validpublic double evaluate(double[] values,
              double mean)
                throws MathIllegalArgumentException
Double.NaN if the designated subarray is empty.
 Returns 0 for a single-value (i.e. length = 1) sample.
The formula used assumes that the supplied mean value is the arithmetic mean of the sample data, not a known population parameter. This method is supplied only to save computation when the mean has already been computed.
 Throws MathIllegalArgumentException if the array is null.
Does not change the internal state of the statistic.
values - the input arraymean - the precomputed mean valueMathIllegalArgumentException - if the array is nullpublic boolean isBiasCorrected()
public void setBiasCorrected(boolean isBiasCorrected)
isBiasCorrected - The isBiasCorrected to set.public StandardDeviation copy()
copy in interface StorelessUnivariateStatisticcopy in interface UnivariateStatisticcopy in class AbstractStorelessUnivariateStatisticpublic static void copy(StandardDeviation source, StandardDeviation dest) throws NullArgumentException
Neither source nor dest can be null.
source - StandardDeviation to copydest - StandardDeviation to copy toNullArgumentException - if either source or dest is nullCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.