public abstract class AbstractUnivariateStatistic extends Object implements UnivariateStatistic
UnivariateStatistic interface.
Provides a default implementation of evaluate(double[]),
delegating to evaluate(double[], int, int) in the natural way.
Also includes a test method that performs generic parameter
validation for the evaluate methods.
| Constructor and Description |
|---|
AbstractUnivariateStatistic() |
| Modifier and Type | Method and Description |
|---|---|
abstract UnivariateStatistic |
copy()
Returns a copy of the statistic with the same internal state.
|
double |
evaluate()
Returns the result of evaluating the statistic over the stored data.
|
double |
evaluate(double[] values)
Returns the result of evaluating the statistic over the input array.
|
abstract double |
evaluate(double[] values,
int begin,
int length)
Returns the result of evaluating the statistic over the specified entries
in the input array.
|
double[] |
getData()
Get a copy of the stored data array.
|
protected double[] |
getDataRef()
Get a reference to the stored data array.
|
void |
setData(double[] values)
Set the data array.
|
void |
setData(double[] values,
int begin,
int length)
Set the data array.
|
protected boolean |
test(double[] values,
double[] weights,
int begin,
int length)
This method is used by
evaluate(double[], double[], int, int) methods
to verify that the begin and length parameters designate a subarray of positive length
and the weights are all non-negative, non-NaN, finite, and not all zero. |
protected boolean |
test(double[] values,
double[] weights,
int begin,
int length,
boolean allowEmpty)
This method is used by
evaluate(double[], double[], int, int) methods
to verify that the begin and length parameters designate a subarray of positive length
and the weights are all non-negative, non-NaN, finite, and not all zero. |
protected boolean |
test(double[] values,
int begin,
int length)
This method is used by
evaluate(double[], int, int) methods
to verify that the input parameters designate a subarray of positive length. |
protected boolean |
test(double[] values,
int begin,
int length,
boolean allowEmpty)
This method is used by
evaluate(double[], int, int) methods
to verify that the input parameters designate a subarray of positive length. |
public void setData(double[] values)
The stored value is a copy of the parameter array, not the array itself.
values - data array to store (may be null to remove stored data)evaluate()public double[] getData()
protected double[] getDataRef()
public void setData(double[] values,
int begin,
int length)
throws MathIllegalArgumentException
values - data array to storebegin - the index of the first element to includelength - the number of elements to includeMathIllegalArgumentException - if values is null or the indices
are not validevaluate()public double evaluate()
throws MathIllegalArgumentException
The stored array is the one which was set by previous calls to setData(double[]).
MathIllegalArgumentException - if the stored data array is nullpublic double evaluate(double[] values)
throws MathIllegalArgumentException
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionvalues - input arrayMathIllegalArgumentException - if values is nullpublic abstract double evaluate(double[] values,
int begin,
int length)
throws MathIllegalArgumentException
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionvalues - the input arraybegin - the index of the first element to includelength - the number of elements to includeMathIllegalArgumentException - if values is null or the indices are invalidpublic abstract UnivariateStatistic copy()
copy in interface UnivariateStatisticprotected boolean test(double[] values,
int begin,
int length)
throws MathIllegalArgumentException
evaluate(double[], int, int) methods
to verify that the input parameters designate a subarray of positive length.
true iff the parameters designate a subarray of
positive lengthMathIllegalArgumentException if the array is null or
or the indices are invalidfalselength is 0.
values - the input arraybegin - index of the first array element to includelength - the number of elements to includeMathIllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(double[] values,
int begin,
int length,
boolean allowEmpty)
throws MathIllegalArgumentException
evaluate(double[], int, int) methods
to verify that the input parameters designate a subarray of positive length.
true iff the parameters designate a subarray of
non-negative lengthIllegalArgumentException if the array is null or
or the indices are invalidfalselength is 0 unless allowEmpty is true
values - the input arraybegin - index of the first array element to includelength - the number of elements to includeallowEmpty - if true then zero length arrays are allowedMathIllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(double[] values,
double[] weights,
int begin,
int length)
throws MathIllegalArgumentException
evaluate(double[], double[], int, int) methods
to verify that the begin and length parameters designate a subarray of positive length
and the weights are all non-negative, non-NaN, finite, and not all zero.
true iff the parameters designate a subarray of
positive length and the weights array contains legitimate values.IllegalArgumentException if any of the following are true:
falselength is 0.
values - the input arrayweights - the weights arraybegin - index of the first array element to includelength - the number of elements to includeMathIllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(double[] values,
double[] weights,
int begin,
int length,
boolean allowEmpty)
throws MathIllegalArgumentException
evaluate(double[], double[], int, int) methods
to verify that the begin and length parameters designate a subarray of positive length
and the weights are all non-negative, non-NaN, finite, and not all zero.
true iff the parameters designate a subarray of
non-negative length and the weights array contains legitimate values.MathIllegalArgumentException if any of the following are true:
falselength is 0 unless allowEmpty is true.
values - the input array.weights - the weights array.begin - index of the first array element to include.length - the number of elements to include.allowEmpty - if true than allow zero length arrays to pass.true if the parameters are valid.NullArgumentException - if either of the arrays are nullMathIllegalArgumentException - if the array indices are not valid,
the weights array contains NaN, infinite or negative elements, or there
are no positive weights.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.