cern.jet.random
Class Wald

java.lang.Object
  |
  +--cern.colt.PersistentObject
        |
        +--cern.jet.random.AbstractDistribution
              |
              +--cern.jet.random.AbstractContinousDistribution
                    |
                    +--cern.jet.random.Wald
All Implemented Interfaces:
java.lang.Cloneable, cern.colt.function.DoubleFunction, cern.colt.function.IntFunction, java.io.Serializable

public class Wald
extends AbstractContinousDistribution

Wald distribution; also called Inverse Gaussian distribution;

p(x) = sqrt(lambda/(2*pi*x^3)) * exp(-lambda*(x-mu)^2/(2*mu^2*x))

Valid parameter ranges: x,lambda > 0.

Instance methods operate on a user supplied uniform random number generator; they are unsynchronized.

Static methods operate on a default uniform random number generator; they are synchronized.

Implementation:

Method: Ratio of Uniforms with shift.
High performance implementation. This is a port of Random Number Generators by Professor Hossein Arsham. This implementation, in turn, is based on Michael, et al. (1976) as refered in Zabel's Dissertation

See Also:
Serialized Form

Field Summary
protected  double ch2
           
protected  double lam
           
protected  double mu
           
protected static Wald shared
           
 
Fields inherited from class cern.jet.random.AbstractDistribution
randomGenerator
 
Constructor Summary
Wald(double m, double l, RandomElement randomGenerator)
          Constructs a Wald distribution.
 
Method Summary
 double cdf(double x, double y)
          Returns the cumulative distribution function.
 double nextCh2(double freedom)
           
 double nextDouble()
          Returns a random number from the distribution.
 double nextDouble(double u, double lambda)
          Returns a random number from the distribution; bypasses the internal state.
 double pdf(double x)
          Returns the probability distribution function.
 void setState(double u, double lambda)
          Sets the distribution parameter.
static double staticNextDouble(double u, double lambda)
          Returns a random number from the distribution.
 java.lang.String toString()
          Returns a String representation of the receiver.
 
Methods inherited from class cern.jet.random.AbstractDistribution
apply, apply, clone, getRandomGenerator, makeDefaultGenerator, nextInt, setRandomGenerator
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mu

protected double mu

lam

protected double lam

ch2

protected double ch2

shared

protected static Wald shared
Constructor Detail

Wald

public Wald(double m,
            double l,
            RandomElement randomGenerator)
Constructs a Wald distribution. Example: m = 1.0, l = 1.0.

Parameters:
m - mean value.
l - scale parameter.
Throws:
java.lang.IllegalArgumentException - if mu, lambda < 0.0.
Method Detail

cdf

public double cdf(double x,
                  double y)
Returns the cumulative distribution function.


nextDouble

public double nextDouble()
Returns a random number from the distribution.

Specified by:
nextDouble in class AbstractDistribution

nextDouble

public double nextDouble(double u,
                         double lambda)
Returns a random number from the distribution; bypasses the internal state.

Parameters:
u - mean parameter
lambda - scale parameter It should hold mu, lambda > 0.

nextCh2

public double nextCh2(double freedom)

pdf

public double pdf(double x)
Returns the probability distribution function.


setState

public void setState(double u,
                     double lambda)
Sets the distribution parameter.

Parameters:
u - mean parameter^M
lambda - scale parameter^M

staticNextDouble

public static double staticNextDouble(double u,
                                      double lambda)
Returns a random number from the distribution.

Parameters:
u - mean parameter^M
lambda - scale parameter^M

toString

public java.lang.String toString()
Returns a String representation of the receiver.

Overrides:
toString in class java.lang.Object