org.matheclipse.core.stat.descriptive.summary
Class SymbolicSumOfLogs
- java.lang.Object
-
- org.matheclipse.core.stat.descriptive.AbstractSymbolicStorelessUnivariateStatistic
-
- org.matheclipse.core.stat.descriptive.summary.SymbolicSumOfLogs
-
- All Implemented Interfaces:
- java.io.Serializable, StorelessSymbolicUnivariateStatistic, SymbolicUnivariateStatistic
public class SymbolicSumOfLogs extends AbstractSymbolicStorelessUnivariateStatistic implements java.io.Serializable
Returns the sum of the natural logs for this collection of values.Therefore,
- If any of values are < 0, the result is
NaN. - If all values are non-negative and less than
Double.POSITIVE_INFINITY, but at least one value is 0, the result isDouble.NEGATIVE_INFINITY. - If both
Double.POSITIVE_INFINITYandDouble.NEGATIVE_INFINITYare among the values, the result isNaN.
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()orclear()method, it must be synchronized externally.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SymbolicSumOfLogs()Create a SumOfLogs instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()Clears the internal state of the StatisticIExprevaluate(IAST values, int begin, int length)Returns the sum of the natural logs of the entries in the specified portion of the input array, orDouble.NaNif the designated subarray is empty.longgetN()Returns the number of values that have been added.IExprgetResult()Returns the current value of the Statistic.voidincrement(IExpr d)Updates the internal state of the statistic to reflect the addition of the new value.-
Methods inherited from class org.matheclipse.core.stat.descriptive.AbstractSymbolicStorelessUnivariateStatistic
evaluate, incrementAll, incrementAll
-
-
-
-
Method Detail
-
increment
public void increment(IExpr d)
Updates the internal state of the statistic to reflect the addition of the new value.- Specified by:
incrementin interfaceStorelessSymbolicUnivariateStatistic- Specified by:
incrementin classAbstractSymbolicStorelessUnivariateStatistic- Parameters:
d- the new value.
-
getResult
public IExpr getResult()
Returns the current value of the Statistic.- Specified by:
getResultin interfaceStorelessSymbolicUnivariateStatistic- Specified by:
getResultin classAbstractSymbolicStorelessUnivariateStatistic- Returns:
- value of the statistic,
Double.NaNif it has been cleared or just instantiated.
-
getN
public long getN()
Returns the number of values that have been added.- Specified by:
getNin interfaceStorelessSymbolicUnivariateStatistic- Specified by:
getNin classAbstractSymbolicStorelessUnivariateStatistic- Returns:
- the number of values.
-
clear
public void clear()
Clears the internal state of the Statistic- Specified by:
clearin interfaceStorelessSymbolicUnivariateStatistic- Specified by:
clearin classAbstractSymbolicStorelessUnivariateStatistic
-
evaluate
public IExpr evaluate(IAST values, int begin, int length)
Returns the sum of the natural logs of the entries in the specified portion of the input array, orDouble.NaNif the designated subarray is empty.Throws
IllegalArgumentExceptionif the array is null.See
SymbolicSumOfLogs.- Specified by:
evaluatein interfaceSymbolicUnivariateStatistic- Overrides:
evaluatein classAbstractSymbolicStorelessUnivariateStatistic- Parameters:
values- the input arraybegin- index of the first array element to includelength- the number of elements to include- Returns:
- the sum of the natural logs of the values or 0 if length = 0
- Throws:
java.lang.IllegalArgumentException- if the array is null or the array index parameters are not valid- See Also:
UnivariateStatistic.evaluate(double[], int, int)
-
-
DMelt 3.0 © DataMelt by jWork.ORG