public class AdaptiveRejectionSampling.UpperEnvelope extends AdaptiveRejectionSampling.AbstractEnvelope implements ProbabilityFunction<java.lang.Double>
Modifier and Type | Field and Description |
---|---|
protected double[] |
segmentCDF
Cumulative sums of the normalized weights of the lines...
|
lines
Constructor and Description |
---|
UpperEnvelope()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
AdaptiveRejectionSampling.UpperEnvelope |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
protected void |
computeLines()
Recomputes the line segments that comprise the upper envelope
|
java.lang.Double |
getMean()
Gets the mean, which is not a supported operation.
|
AdaptiveRejectionSampling.UpperEnvelope |
getProbabilityFunction()
Gets the distribution function associated with this Distribution,
either the PDF or PMF.
|
java.lang.Double |
sample(java.util.Random random)
Draws a single random sample from the distribution.
|
java.util.ArrayList<java.lang.Double> |
sample(java.util.Random random,
int numSamples)
Draws multiple random samples from the distribution.
|
double |
sampleAsDouble(java.util.Random random)
Samples from this distribution as a double.
|
void |
sampleInto(java.util.Random random,
int sampleCount,
java.util.Collection<? super java.lang.Double> output)
Draws multiple random samples from the distribution and puts the result
into the given collection.
|
evaluate, findLineSegment, getLines, logEvaluate, resetLines
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
logEvaluate
evaluate, evaluateAsDouble
protected double[] segmentCDF
public AdaptiveRejectionSampling.UpperEnvelope clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AdaptiveRejectionSampling.AbstractEnvelope
public AdaptiveRejectionSampling.UpperEnvelope getProbabilityFunction()
ComputableDistribution
getProbabilityFunction
in interface ComputableDistribution<java.lang.Double>
public java.lang.Double getMean()
public double sampleAsDouble(java.util.Random random)
random
- The random number generator to use.public java.lang.Double sample(java.util.Random random)
Distribution
sample
in interface Distribution<java.lang.Double>
random
- Random-number generator to use in order to generate random numbers.public java.util.ArrayList<java.lang.Double> sample(java.util.Random random, int numSamples)
Distribution
sample
in interface Distribution<java.lang.Double>
random
- Random-number generator to use in order to generate random numbers.numSamples
- Number of samples to draw from the distribution.public void sampleInto(java.util.Random random, int sampleCount, java.util.Collection<? super java.lang.Double> output)
Distribution
sampleInto
in interface Distribution<java.lang.Double>
random
- Random number generator to use.sampleCount
- The number of samples to draw. Cannot be negative.output
- The collection to add the samples into.protected void computeLines()
computeLines
in class AdaptiveRejectionSampling.AbstractEnvelope