org.terrier.statistics
Class GammaFunction

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

public abstract class GammaFunction
extends Object
implements 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
    static void main(String[] args)
               
     
    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


    main

    public static void main(String[] args)

    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.6. Copyright © 2004-2011 University of Glasgow