Package org.hipparchus.util
Class CombinatoricsUtils.FactorialLog
java.lang.Object
org.hipparchus.util.CombinatoricsUtils.FactorialLog
- Enclosing class:
- CombinatoricsUtils
Class for computing the natural logarithm of the factorial of
n
.
It allows to allocate a cache of precomputed values.
In case of cache miss, computation is preformed by a call to
Gamma.logGamma(double)
.-
Method Details
-
create
Creates an instance with no precomputed values.- Returns:
- instance with no precomputed values
-
withCache
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
.
-