de.unihalle.informatik.MiToBo.math
Class LogFaculty

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.math.LogFaculty

public class LogFaculty
extends java.lang.Object

Class to compute the logarithm of the faculty of an integer n. This class stores all values from log(0!) to log(n_max!) to provide fast access for values of n in the range [0,n_max]. If values for n > n_max are requested, the internal array is extended and n_max := n.

Author:
Oliver Gress

Field Summary
private  double[] logfac
          array to store log(0!)
 
Constructor Summary
LogFaculty(int n_max)
          Constructor to precompute log(0!)
 
Method Summary
 double getLogFaculty(int n)
          log(n!)
 double getLogFacultyFraction(int n1, int n2)
          log(n1!
 int getMaxN()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logfac

private double[] logfac
array to store log(0!) to log(n!)

Constructor Detail

LogFaculty

public LogFaculty(int n_max)
Constructor to precompute log(0!) to log(n_max!)

Parameters:
n_max -
Method Detail

getLogFaculty

public double getLogFaculty(int n)
log(n!)

Parameters:
n -
Returns:

getLogFacultyFraction

public double getLogFacultyFraction(int n1,
                                    int n2)
log(n1! / n2!)

Parameters:
n1 - nominator faculty
n2 - denominator faculty
Returns:
log of n1!/n2!

getMaxN

public int getMaxN()