org.apache.mahout.math.jet.random
Class Exponential

java.lang.Object
  extended by org.apache.mahout.math.jet.random.AbstractDistribution
      extended by org.apache.mahout.math.jet.random.AbstractContinousDistribution
          extended by org.apache.mahout.math.jet.random.Exponential
All Implemented Interfaces:
DoubleFunction, IntFunction

public class Exponential
extends AbstractContinousDistribution


Constructor Summary
Exponential(double lambda, Random randomGenerator)
          Provides a negative exponential distribution given a rate parameter lambda and an underlying random number generator.
 
Method Summary
 double cdf(double x)
          Returns the cumulative distribution function.
 double nextDouble()
          Returns a random number from the distribution.
 double pdf(double x)
          Returns the value of the probability density function at a particular point.
 void setState(double lambda)
          Sets the rate parameter.
 String toString()
          Returns a String representation of the receiver.
 
Methods inherited from class org.apache.mahout.math.jet.random.AbstractContinousDistribution
nextInt
 
Methods inherited from class org.apache.mahout.math.jet.random.AbstractDistribution
apply, apply, getRandomGenerator, randomDouble, setRandomGenerator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Exponential

public Exponential(double lambda,
                   Random randomGenerator)
Provides a negative exponential distribution given a rate parameter lambda and an underlying random number generator. The mean of this distribution will be equal to 1/lambda.

Parameters:
lambda - The rate parameter of the distribution.
randomGenerator - The PRNG that is used to generate values.
Method Detail

cdf

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

Overrides:
cdf in class AbstractContinousDistribution
Parameters:
x - The point at which the cumulative distribution function is to be evaluated.
Returns:
Returns the integral from -infinity to x of the PDF, also known as the cumulative distribution function.

nextDouble

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

Specified by:
nextDouble in class AbstractDistribution
Returns:
A new sample from this distribution.

pdf

public double pdf(double x)
Returns the value of the probability density function at a particular point.

Overrides:
pdf in class AbstractContinousDistribution
Parameters:
x - The point at which the probability density function is to be evaluated.
Returns:
The value of the probability density function at the specified point.

setState

public void setState(double lambda)
Sets the rate parameter.

Parameters:
lambda - The new value of the rate parameter.

toString

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

Overrides:
toString in class Object


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.