public final class CumulativeDistribution
extends java.lang.Object
A cumulative distribution is a sequence of monotonic numbers in the range (0,..,1]
Modifier and Type | Field and Description |
---|---|
private double[] |
data |
Constructor and Description |
---|
CumulativeDistribution(double[] data)
Creates a CumulativeDistribution, using the provided data as internal representation.
|
Modifier and Type | Method and Description |
---|---|
int |
getValueFor(double argument)
Looks up this cumulative distribution for a given argument.
|
java.lang.String |
toString() |
public CumulativeDistribution(double[] data)
Creates a CumulativeDistribution, using the provided data as internal representation.
The assumptions on this data are that: - It is monotonic: data[i+1] >= data[i]
- It is included in the range (0,1]: data[0] >= 0.0, data[data.length] == 1.0
These assumptions are not checked, for efficiency purposes, but failing to meet them might result in undefined behavior.
data
- The distribution data, should be a monotonic range included in (0,1]public int getValueFor(double argument)
Looks up this cumulative distribution for a given argument. This method returns the index of the first element which is equal or greater than the given argument.
The assumption on this argument is that it is included in the distribution range, that is [0,1]. (It can be 0, as we are looking for greater or equal elements). This assumption is not checked, for efficiency purposes, but failing to meet it might result in undefined behavior.
argument
- The argument, should be contained in the range [0,1].public java.lang.String toString()
toString
in class java.lang.Object