Package org.hipparchus.util
Class CombinatoricsUtils.FactorialLog
- java.lang.Object
-
- org.hipparchus.util.CombinatoricsUtils.FactorialLog
-
- Enclosing class:
- CombinatoricsUtils
public static final class CombinatoricsUtils.FactorialLog extends Object
Class for computing the natural logarithm of the factorial ofn
. It allows to allocate a cache of precomputed values. In case of cache miss, computation is preformed by a call toGamma.logGamma(double)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CombinatoricsUtils.FactorialLog
create()
Creates an instance with no precomputed values.double
value(int n)
Computeslog(n!)
.CombinatoricsUtils.FactorialLog
withCache(int cacheSize)
Creates an instance with the specified cache size.
-
-
-
Method Detail
-
create
public static CombinatoricsUtils.FactorialLog create()
Creates an instance with no precomputed values.- Returns:
- instance with no precomputed values
-
withCache
public CombinatoricsUtils.FactorialLog withCache(int cacheSize)
Creates an instance with the specified cache size.- Parameters:
cacheSize
- Number of precomputed values of the function.- Returns:
- a new instance where
cacheSize
values have been precomputed. - Throws:
MathIllegalArgumentException
- ifn < 0
.
-
value
public double value(int n)
Computeslog(n!)
.- Parameters:
n
- Argument.- Returns:
log(n!)
.- Throws:
MathIllegalArgumentException
- ifn < 0
.
-
-