public abstract class AbstractSymbolicStorelessUnivariateStatistic extends java.lang.Object implements StorelessSymbolicUnivariateStatistic
StorelessUnivariateStatistic interface.
Provides default evaluate() and incrementAll(double[])
implementations.
Note that these implementations are not synchronized.
| Constructor and Description |
|---|
AbstractSymbolicStorelessUnivariateStatistic() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Clears the internal state of the Statistic
|
IExpr |
evaluate(IAST values)
This default implementation calls
clear(), then invokes
increment(org.matheclipse.core.interfaces.IExpr) in a loop over the the input array, and then uses
getResult() to compute the return value. |
IExpr |
evaluate(IAST values,
int begin,
int length)
This default implementation calls
clear(), then invokes
increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array,
and then uses getResult() to compute the return value. |
abstract long |
getN()
Returns the number of values that have been added.
|
abstract IExpr |
getResult()
Returns the current value of the Statistic.
|
abstract void |
increment(IExpr d)
Updates the internal state of the statistic to reflect the addition of the
new value.
|
void |
incrementAll(IAST values)
This default implementation just calls
increment(org.matheclipse.core.interfaces.IExpr) in a loop over
the input array. |
void |
incrementAll(IAST values,
int begin,
int length)
This default implementation just calls
increment(org.matheclipse.core.interfaces.IExpr) in a loop over
the specified portion of the input array. |
protected boolean |
test(IAST values,
IAST 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(IAST values,
IAST 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(IAST 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(IAST 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 AbstractSymbolicStorelessUnivariateStatistic()
public IExpr evaluate(IAST values)
clear(), then invokes
increment(org.matheclipse.core.interfaces.IExpr) in a loop over the the input array, and then uses
getResult() to compute the return value.
Note that this implementation changes the internal state of the statistic.
Its side effects are the same as invoking clear() and then
#incrementAll(double[]).
Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.
If the array is null, an IllegalArgumentException is thrown.
evaluate in interface SymbolicUnivariateStatisticvalues - input arrayUnivariateStatistic.evaluate(double[])public IExpr evaluate(IAST values, int begin, int length)
clear(), then invokes
increment(org.matheclipse.core.interfaces.IExpr) in a loop over the specified portion of the input array,
and then uses getResult() to compute the return value.
Note that this implementation changes the internal state of the statistic.
Its side effects are the same as invoking clear() and then
#incrementAll(double[], int, int).
Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.
If the array is null or the index parameters are not valid, an IllegalArgumentException is thrown.
evaluate in interface SymbolicUnivariateStatisticvalues - the input arraybegin - the index of the first element to includelength - the number of elements to includeUnivariateStatistic.evaluate(double[],
int, int)public abstract long getN()
StorelessSymbolicUnivariateStatisticgetN in interface StorelessSymbolicUnivariateStatisticpublic abstract void clear()
clear in interface StorelessSymbolicUnivariateStatisticpublic abstract IExpr getResult()
getResult in interface StorelessSymbolicUnivariateStatisticDouble.NaN if it has been
cleared or just instantiated.public abstract void increment(IExpr d)
increment in interface StorelessSymbolicUnivariateStatisticd - the new value.public void incrementAll(IAST values)
increment(org.matheclipse.core.interfaces.IExpr) in a loop over
the input array.
Throws IllegalArgumentException if the input values array is null.
incrementAll in interface StorelessSymbolicUnivariateStatisticvalues - values to addjava.lang.IllegalArgumentException - if values is nullStorelessUnivariateStatistic.incrementAll(double[])public void incrementAll(IAST values, int begin, int length)
increment(org.matheclipse.core.interfaces.IExpr) in a loop over
the specified portion of the input array.
Throws IllegalArgumentException if the input values array is null.
incrementAll in interface StorelessSymbolicUnivariateStatisticvalues - array holding values to addbegin - index of the first array element to addlength - number of array elements to addjava.lang.IllegalArgumentException - if values is nullStorelessUnivariateStatistic.incrementAll(double[],
int, int)protected boolean test(IAST values, int begin, int length)
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 lengthIllegalArgumentException 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 includejava.lang.IllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(IAST values, int begin, int length, boolean allowEmpty)
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 allowedjava.lang.IllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(IAST values, IAST weights, int begin, int length)
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 includejava.lang.IllegalArgumentException - if the indices are invalid or the array is nullprotected boolean test(IAST values, IAST weights, int begin, int length, boolean allowEmpty)
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.IllegalArgumentException 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.java.lang.IllegalArgumentException - if the indices are invalid or the array is null.