edu.iastate.jrelm.util
Class ModifiedEmpiricalWalker
java.lang.Object
cern.colt.PersistentObject
cern.jet.random.AbstractDistribution
cern.jet.random.AbstractDiscreteDistribution
cern.jet.random.EmpiricalWalker
edu.iastate.jrelm.util.ModifiedEmpiricalWalker
- All Implemented Interfaces:
- cern.colt.function.DoubleFunction, cern.colt.function.IntFunction, java.io.Serializable, java.lang.Cloneable
public class ModifiedEmpiricalWalker
- extends cern.jet.random.EmpiricalWalker
A modified version of the EmpricialWalker from Cern's Open Source Libraries for
High Performance Scientific and Technical Computing in Java (Colt 1.2.0). Changes
have been made to the original EmpiricalWalker to avoid problems encountered when
probability distribution functions with uniform relative values are used.
- Author:
- Charles Gieseler
- See Also:
EmpiricalWalker
,
Serialized Form
Fields inherited from class cern.jet.random.EmpiricalWalker |
A, cdf, F, K |
Fields inherited from class cern.jet.random.AbstractDistribution |
randomGenerator |
Fields inherited from class cern.colt.PersistentObject |
serialVersionUID |
Constructor Summary |
ModifiedEmpiricalWalker(double[] pdf,
int interpolationType,
cern.jet.random.engine.RandomEngine randomGenerator)
|
Method Summary |
double |
pdf(int k)
Modified from EmpricalWalker so that pdf values returned are not negative and there is
a value for each index in the original pdf (i.e. |
void |
setRandomEngine(cern.jet.random.engine.RandomEngine engine)
|
void |
setState(double[] pdf,
int interpolationType)
Sets the distribution parameters. |
void |
setState2(double[] pdf)
Modified from EmpiricalWalker to allow nextInt to work properly when the given pdf
contains uniform values. |
Methods inherited from class cern.jet.random.EmpiricalWalker |
cdf, clone, nextInt, toString |
Methods inherited from class cern.jet.random.AbstractDiscreteDistribution |
nextDouble |
Methods inherited from class cern.jet.random.AbstractDistribution |
apply, apply, getRandomGenerator, makeDefaultGenerator, setRandomGenerator |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LINEAR_INTERPOLATION
public static int LINEAR_INTERPOLATION
- Flag to use linear interpolation.
- See Also:
cern.jet.random.EmpiricalWalker
NO_INTERPOLATION
public static int NO_INTERPOLATION
- Flag to use no interpolation.
- See Also:
cern.jet.random.EmpiricalWalker
ModifiedEmpiricalWalker
public ModifiedEmpiricalWalker(double[] pdf,
int interpolationType,
cern.jet.random.engine.RandomEngine randomGenerator)
pdf
public double pdf(int k)
- Modified from EmpricalWalker so that pdf values returned are not negative and there is
a value for each index in the original pdf (i.e. no ArrayIndexOutOfBoundsException when
k=0).
Returns the probability distribution function.
- Overrides:
pdf
in class cern.jet.random.EmpiricalWalker
- See Also:
cern.jet.random.EmpiricalWalker
setState
public void setState(double[] pdf,
int interpolationType)
- Sets the distribution parameters.
The pdf must satisfy all of the following conditions
- pdf != null && pdf.length > 0
- 0.0 <= pdf[i] : 0 < =i <= pdf.length-1
- 0.0 < Sum(pdf[i]) : 0 <=i <= pdf.length-1
- Overrides:
setState
in class cern.jet.random.EmpiricalWalker
- Parameters:
pdf
- probability distribution function.
- Throws:
java.lang.IllegalArgumentException
- if at least one of the three conditions above is violated.- See Also:
EmpiricalWalker.setState(double[], int)
setState2
public void setState2(double[] pdf)
- Modified from EmpiricalWalker to allow nextInt to work properly when the given pdf
contains uniform values.
Sets the distribution parameters.
The pdf must satisfy both of the following conditions
- 0.0 <= pdf[i] : 0 < =i <= pdf.length-1
- 0.0 < Sum(pdf[i]) : 0 <=i <= pdf.length-1
- Overrides:
setState2
in class cern.jet.random.EmpiricalWalker
- Parameters:
pdf
- probability distribution function.
- Throws:
java.lang.IllegalArgumentException
- if at least one of the three conditions above is violated.- See Also:
EmpiricalWalker.setState2(double[])
setRandomEngine
public void setRandomEngine(cern.jet.random.engine.RandomEngine engine)