public abstract class LineSampler extends Object implements SharedStateObjectSampler<double[]>
Sampling uses:
| Modifier and Type | Method and Description |
|---|---|
protected abstract double[] |
createSample(double p1mu,
double u)
Creates the sample given the random variate
u in the
interval [0, 1]. |
static LineSampler |
of(UniformRandomProvider rng,
double[] a,
double[] b)
Create a line sampler with vertices
a and b. |
double[] |
sample()
Create an object sample.
|
abstract LineSampler |
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsamples, samplespublic double[] sample()
ObjectSamplersample in interface ObjectSampler<double[]>protected abstract double[] createSample(double p1mu, double u)
u in the
interval [0, 1]. The sum 1 - u is provided.
The sample can be obtained from the line ab using:
p = a(1 - u) + ub
p1mu - plus 1 minus u (1 - u)u - the variate upublic abstract LineSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider in interface SharedStateSampler<SharedStateObjectSampler<double[]>>rng - Generator of uniformly distributed random numbers.public static LineSampler of(UniformRandomProvider rng, double[] a, double[] b)
a and b.
Sampled points are uniformly distributed on the line segment ab.
Sampling is supported in dimensions of 1 or above.
rng - Source of randomness.a - The first vertex.b - The second vertex.IllegalArgumentException - If the vertices do not have the same
dimension; the dimension is less than 1; or vertices have non-finite coordinates.Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.