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 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

      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 - if n < 0.
    • value

      public double value(int n)
      Computes log(n!).
      Parameters:
      n - Argument.
      Returns:
      log(n!).
      Throws:
      MathIllegalArgumentException - if n < 0.