org.terrier.statistics
Class GammaFunction

java.lang.Object
  extended by org.terrier.statistics.GammaFunction
All Implemented Interfaces:
java.io.Serializable

public abstract class GammaFunction
extends java.lang.Object
implements java.io.Serializable

Base class for implementations of the Gamma function. Use getGammaFunction() to obtain an instance. The exact instance can be controlled by property gamma.function For consistency when computing logarithms of the gamma function, all implementations assume positive input values. In practice, as the gamma function can generate large values, normal usage should use compute_log() anyway.

Properties:

<ul>
  • gamma.function - class name of the Gamma function implementation. Defaults to use WikipediaLanczosGammaFunction

    Since:
    3.0
    Author:
    Craig Macdonald
    See Also:
    Serialized Form

    Constructor Summary
    GammaFunction()
               
     
    Method Summary
    abstract  double compute_log(double number)
              Get the value of the log of gamma function for the specified number.
    abstract  double compute(double number)
              Get the value of the gamma function for the specified number.
    static long factorial(long n)
              Compute factorial of n, for 0 < n < 21.
    static GammaFunction getGammaFunction()
              Obtain an instance of GammaFunction
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    GammaFunction

    public GammaFunction()
    Method Detail

    compute

    public abstract double compute(double number)
    Get the value of the gamma function for the specified number.

    Parameters:
    number - for which is required
    Returns:
    (n-1)!

    compute_log

    public abstract double compute_log(double number)
    Get the value of the log of gamma function for the specified number.

    Parameters:
    number - for which is required
    Returns:
    log(n-1)!

    getGammaFunction

    public static final GammaFunction getGammaFunction()
    Obtain an instance of GammaFunction


    factorial

    public static final long factorial(long n)
    Compute factorial of n, for 0 < n < 21.

    Parameters:
    n - number to compute for
    Returns:
    factorial of n


    Terrier 3.5. Copyright © 2004-2011 University of Glasgow