Class LineSampler.LineSampler3D
java.lang.Object
org.apache.commons.rng.sampling.shape.LineSampler
org.apache.commons.rng.sampling.shape.LineSampler.LineSampler3D
- All Implemented Interfaces:
ObjectSampler<double[]>
,SharedStateObjectSampler<double[]>
,SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
LineSampler
Sample uniformly from a line in 3D. This is an non-array based specialisation of
LineSampler.LineSamplerND
for performance.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double
The x component of vertex a.private final double
The y component of vertex a.private final double
The z component of vertex a.private final double
The x component of vertex b.private final double
The y component of vertex b.private final double
The z component of vertex b. -
Constructor Summary
ConstructorsConstructorDescriptionLineSampler3D
(UniformRandomProvider rng, double[] a, double[] b) LineSampler3D
(UniformRandomProvider rng, LineSampler.LineSampler3D source) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
createSample
(double p1mu, double u) Creates the sample given the random variateu
in the interval[0, 1]
.Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.Methods inherited from class org.apache.commons.rng.sampling.shape.LineSampler
of, sample
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.rng.sampling.ObjectSampler
samples, samples
-
Field Details
-
ax
private final double axThe x component of vertex a. -
ay
private final double ayThe y component of vertex a. -
az
private final double azThe z component of vertex a. -
bx
private final double bxThe x component of vertex b. -
by
private final double byThe y component of vertex b. -
bz
private final double bzThe z component of vertex b.
-
-
Constructor Details
-
LineSampler3D
LineSampler3D(UniformRandomProvider rng, double[] a, double[] b) - Parameters:
rng
- Source of randomness.a
- The first vertex.b
- The second vertex.
-
LineSampler3D
LineSampler3D(UniformRandomProvider rng, LineSampler.LineSampler3D source) - Parameters:
rng
- Source of randomness.source
- Source to copy.
-
-
Method Details
-
createSample
public double[] createSample(double p1mu, double u) Description copied from class:LineSampler
Creates the sample given the random variateu
in the interval[0, 1]
. The sum1 - u
is provided. The sample can be obtained from the line ab using:p = a(1 - u) + ub
- Specified by:
createSample
in classLineSampler
- Parameters:
p1mu
- plus 1 minus u (1 - u)u
- the variate u- Returns:
- the sample
-
withUniformRandomProvider
Description copied from class:LineSampler
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateObjectSampler<double[]>>
- Specified by:
withUniformRandomProvider
in classLineSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-