Class AbstractSymbolicStorelessUnivariateStatistic
- java.lang.Object
-
- org.matheclipse.core.stat.descriptive.AbstractSymbolicStorelessUnivariateStatistic
-
- All Implemented Interfaces:
- StorelessSymbolicUnivariateStatistic, SymbolicUnivariateStatistic
- Direct Known Subclasses:
- SymbolicGeometricMean, SymbolicProduct, SymbolicSum, SymbolicSumOfLogs
public abstract class AbstractSymbolicStorelessUnivariateStatistic extends java.lang.Object implements StorelessSymbolicUnivariateStatistic
Abstract implementation of theStorelessUnivariateStatisticinterface.Provides default
evaluate()andincrementAll(double[])implementations.Note that these implementations are not synchronized.
-
-
Constructor Summary
Constructors Constructor and Description AbstractSymbolicStorelessUnivariateStatistic()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract voidclear()Clears the internal state of the StatisticIExprevaluate(IAST values)This default implementation callsclear(), then invokesincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the the input array, and then usesgetResult()to compute the return value.IExprevaluate(IAST values, int begin, int length)This default implementation callsclear(), then invokesincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the specified portion of the input array, and then usesgetResult()to compute the return value.abstract longgetN()Returns the number of values that have been added.abstract IExprgetResult()Returns the current value of the Statistic.abstract voidincrement(IExpr d)Updates the internal state of the statistic to reflect the addition of the new value.voidincrementAll(IAST values)This default implementation just callsincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the input array.voidincrementAll(IAST values, int begin, int length)This default implementation just callsincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the specified portion of the input array.
-
-
-
Constructor Detail
-
AbstractSymbolicStorelessUnivariateStatistic
public AbstractSymbolicStorelessUnivariateStatistic()
-
-
Method Detail
-
evaluate
public IExpr evaluate(IAST values)
This default implementation callsclear(), then invokesincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the the input array, and then usesgetResult()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.
- Specified by:
evaluatein interfaceSymbolicUnivariateStatistic- Parameters:
values- input array- Returns:
- the value of the statistic applied to the input array
- See Also:
UnivariateStatistic.evaluate(double[])
-
evaluate
public IExpr evaluate(IAST values, int begin, int length)
This default implementation callsclear(), then invokesincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the specified portion of the input array, and then usesgetResult()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.
- Specified by:
evaluatein interfaceSymbolicUnivariateStatistic- Parameters:
values- the input arraybegin- the index of the first element to includelength- the number of elements to include- Returns:
- the value of the statistic applied to the included array entries
- See Also:
UnivariateStatistic.evaluate(double[], int, int)
-
getN
public abstract long getN()
Description copied from interface:StorelessSymbolicUnivariateStatisticReturns the number of values that have been added.- Specified by:
getNin interfaceStorelessSymbolicUnivariateStatistic- Returns:
- the number of values.
-
clear
public abstract void clear()
Clears the internal state of the Statistic- Specified by:
clearin interfaceStorelessSymbolicUnivariateStatistic
-
getResult
public abstract IExpr getResult()
Returns the current value of the Statistic.- Specified by:
getResultin interfaceStorelessSymbolicUnivariateStatistic- Returns:
- value of the statistic,
Double.NaNif it has been cleared or just instantiated.
-
increment
public abstract void increment(IExpr d)
Updates the internal state of the statistic to reflect the addition of the new value.- Specified by:
incrementin interfaceStorelessSymbolicUnivariateStatistic- Parameters:
d- the new value.
-
incrementAll
public void incrementAll(IAST values)
This default implementation just callsincrement(org.matheclipse.core.interfaces.IExpr)in a loop over the input array.Throws IllegalArgumentException if the input values array is null.
- Specified by:
incrementAllin interfaceStorelessSymbolicUnivariateStatistic- Parameters:
values- values to add- Throws:
java.lang.IllegalArgumentException- if values is null- See Also:
StorelessUnivariateStatistic.incrementAll(double[])
-
incrementAll
public void incrementAll(IAST values, int begin, int length)
This default implementation just callsincrement(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.
- Specified by:
incrementAllin interfaceStorelessSymbolicUnivariateStatistic- Parameters:
values- array holding values to addbegin- index of the first array element to addlength- number of array elements to add- Throws:
java.lang.IllegalArgumentException- if values is null- See Also:
StorelessUnivariateStatistic.incrementAll(double[], int, int)
-
-
DMelt 3.0 © DataMelt by jWork.ORG