public class SynchronizedMultivariateSummaryStatistics extends MultivariateSummaryStatistics
MultivariateSummaryStatistics
that
is safe to use in a multithreaded environment. Multiple threads can safely
operate on a single instance without causing runtime exceptions due to race
conditions. In effect, this implementation makes modification and access
methods atomic operations for a single instance. That is to say, as one
thread is computing a statistic from the instance, no other thread can modify
the instance nor compute another statistic.Constructor and Description |
---|
SynchronizedMultivariateSummaryStatistics(int k,
boolean isCovarianceBiasCorrected)
Construct a SynchronizedMultivariateSummaryStatistics instance
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(double[] value)
Add an n-tuple to the data
|
void |
clear()
Resets all statistics and storage
|
boolean |
equals(Object object)
Returns true iff
object is a MultivariateSummaryStatistics
instance and all statistics have the same values as this. |
RealMatrix |
getCovariance()
Returns the covariance matrix of the values that have been added.
|
int |
getDimension()
Returns the dimension of the data
|
StorelessUnivariateStatistic[] |
getGeoMeanImpl()
Returns the currently configured geometric mean implementation
|
double[] |
getGeometricMean()
Returns an array whose ith entry is the geometric mean of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
double[] |
getMax()
Returns an array whose ith entry is the maximum of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getMaxImpl()
Returns the currently configured maximum implementation
|
double[] |
getMean()
Returns an array whose ith entry is the mean of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getMeanImpl()
Returns the currently configured mean implementation
|
double[] |
getMin()
Returns an array whose ith entry is the minimum of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getMinImpl()
Returns the currently configured minimum implementation
|
long |
getN()
Returns the number of available values
|
double[] |
getStandardDeviation()
Returns an array whose ith entry is the standard deviation of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
double[] |
getSum()
Returns an array whose ith entry is the sum of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getSumImpl()
Returns the currently configured Sum implementation
|
double[] |
getSumLog()
Returns an array whose ith entry is the sum of logs of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getSumLogImpl()
Returns the currently configured sum of logs implementation
|
double[] |
getSumSq()
Returns an array whose ith entry is the sum of squares of the
ith entries of the arrays that have been added using
MultivariateSummaryStatistics.addValue(double[]) |
StorelessUnivariateStatistic[] |
getSumsqImpl()
Returns the currently configured sum of squares implementation
|
int |
hashCode()
Returns hash code based on values of statistics
|
void |
setGeoMeanImpl(StorelessUnivariateStatistic[] geoMeanImpl)
Sets the implementation for the geometric mean.
|
void |
setMaxImpl(StorelessUnivariateStatistic[] maxImpl)
Sets the implementation for the maximum.
|
void |
setMeanImpl(StorelessUnivariateStatistic[] meanImpl)
Sets the implementation for the mean.
|
void |
setMinImpl(StorelessUnivariateStatistic[] minImpl)
Sets the implementation for the minimum.
|
void |
setSumImpl(StorelessUnivariateStatistic[] sumImpl)
Sets the implementation for the Sum.
|
void |
setSumLogImpl(StorelessUnivariateStatistic[] sumLogImpl)
Sets the implementation for the sum of logs.
|
void |
setSumsqImpl(StorelessUnivariateStatistic[] sumsqImpl)
Sets the implementation for the sum of squares.
|
String |
toString()
Generates a text report displaying
summary statistics from values that
have been added.
|
public SynchronizedMultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected)
k
- dimension of the dataisCovarianceBiasCorrected
- if true, the unbiased sample
covariance is computed, otherwise the biased population covariance
is computedpublic void addValue(double[] value) throws DimensionMismatchException
addValue
in class MultivariateSummaryStatistics
value
- the n-tuple to addDimensionMismatchException
- if the length of the array
does not match the one used at constructionpublic int getDimension()
getDimension
in interface StatisticalMultivariateSummary
getDimension
in class MultivariateSummaryStatistics
public long getN()
getN
in interface StatisticalMultivariateSummary
getN
in class MultivariateSummaryStatistics
public double[] getSum()
MultivariateSummaryStatistics.addValue(double[])
getSum
in interface StatisticalMultivariateSummary
getSum
in class MultivariateSummaryStatistics
public double[] getSumSq()
MultivariateSummaryStatistics.addValue(double[])
getSumSq
in interface StatisticalMultivariateSummary
getSumSq
in class MultivariateSummaryStatistics
public double[] getSumLog()
MultivariateSummaryStatistics.addValue(double[])
getSumLog
in interface StatisticalMultivariateSummary
getSumLog
in class MultivariateSummaryStatistics
public double[] getMean()
MultivariateSummaryStatistics.addValue(double[])
getMean
in interface StatisticalMultivariateSummary
getMean
in class MultivariateSummaryStatistics
public double[] getStandardDeviation()
MultivariateSummaryStatistics.addValue(double[])
getStandardDeviation
in interface StatisticalMultivariateSummary
getStandardDeviation
in class MultivariateSummaryStatistics
public RealMatrix getCovariance()
getCovariance
in interface StatisticalMultivariateSummary
getCovariance
in class MultivariateSummaryStatistics
public double[] getMax()
MultivariateSummaryStatistics.addValue(double[])
getMax
in interface StatisticalMultivariateSummary
getMax
in class MultivariateSummaryStatistics
public double[] getMin()
MultivariateSummaryStatistics.addValue(double[])
getMin
in interface StatisticalMultivariateSummary
getMin
in class MultivariateSummaryStatistics
public double[] getGeometricMean()
MultivariateSummaryStatistics.addValue(double[])
getGeometricMean
in interface StatisticalMultivariateSummary
getGeometricMean
in class MultivariateSummaryStatistics
public String toString()
toString
in class MultivariateSummaryStatistics
public void clear()
clear
in class MultivariateSummaryStatistics
public boolean equals(Object object)
object
is a MultivariateSummaryStatistics
instance and all statistics have the same values as this.equals
in class MultivariateSummaryStatistics
object
- the object to test equality against.public int hashCode()
hashCode
in class MultivariateSummaryStatistics
public StorelessUnivariateStatistic[] getSumImpl()
getSumImpl
in class MultivariateSummaryStatistics
public void setSumImpl(StorelessUnivariateStatistic[] sumImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the Sum.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setSumImpl
in class MultivariateSummaryStatistics
sumImpl
- the StorelessUnivariateStatistic instance to use
for computing the SumDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getSumsqImpl()
getSumsqImpl
in class MultivariateSummaryStatistics
public void setSumsqImpl(StorelessUnivariateStatistic[] sumsqImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the sum of squares.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setSumsqImpl
in class MultivariateSummaryStatistics
sumsqImpl
- the StorelessUnivariateStatistic instance to use
for computing the sum of squaresDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getMinImpl()
getMinImpl
in class MultivariateSummaryStatistics
public void setMinImpl(StorelessUnivariateStatistic[] minImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the minimum.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setMinImpl
in class MultivariateSummaryStatistics
minImpl
- the StorelessUnivariateStatistic instance to use
for computing the minimumDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getMaxImpl()
getMaxImpl
in class MultivariateSummaryStatistics
public void setMaxImpl(StorelessUnivariateStatistic[] maxImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the maximum.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setMaxImpl
in class MultivariateSummaryStatistics
maxImpl
- the StorelessUnivariateStatistic instance to use
for computing the maximumDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getSumLogImpl()
getSumLogImpl
in class MultivariateSummaryStatistics
public void setSumLogImpl(StorelessUnivariateStatistic[] sumLogImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the sum of logs.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setSumLogImpl
in class MultivariateSummaryStatistics
sumLogImpl
- the StorelessUnivariateStatistic instance to use
for computing the log sumDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getGeoMeanImpl()
getGeoMeanImpl
in class MultivariateSummaryStatistics
public void setGeoMeanImpl(StorelessUnivariateStatistic[] geoMeanImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the geometric mean.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setGeoMeanImpl
in class MultivariateSummaryStatistics
geoMeanImpl
- the StorelessUnivariateStatistic instance to use
for computing the geometric meanDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)public StorelessUnivariateStatistic[] getMeanImpl()
getMeanImpl
in class MultivariateSummaryStatistics
public void setMeanImpl(StorelessUnivariateStatistic[] meanImpl) throws DimensionMismatchException, MathIllegalStateException
Sets the implementation for the mean.
This method must be activated before any data has been added - i.e.,
before addValue
has been used to add data;
otherwise an IllegalStateException will be thrown.
setMeanImpl
in class MultivariateSummaryStatistics
meanImpl
- the StorelessUnivariateStatistic instance to use
for computing the meanDimensionMismatchException
- if the array dimension
does not match the one used at constructionMathIllegalStateException
- if data has already been added
(i.e if n > 0)Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.