Class LineSampler.LineSamplerND
java.lang.Object
org.apache.commons.rng.sampling.shape.LineSampler
org.apache.commons.rng.sampling.shape.LineSampler.LineSamplerND
- All Implemented Interfaces:
ObjectSampler<double[]>, SharedStateObjectSampler<double[]>, SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
LineSampler
Sample uniformly from a line in ND.
- Since:
- 1.4
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLineSamplerND(UniformRandomProvider rng, double[] a, double[] b) LineSamplerND(UniformRandomProvider rng, LineSampler.LineSamplerND source) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]createSample(double p1mu, double u) Creates the sample given the random variateuin 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 LineSampler
of, sampleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectSampler
samples, samples
-
Field Details
-
a
private final double[] aThe first vertex. -
b
private final double[] bThe second vertex.
-
-
Constructor Details
-
LineSamplerND
LineSamplerND(UniformRandomProvider rng, double[] a, double[] b) - Parameters:
rng- Source of randomness.a- The first vertex.b- The second vertex.
-
LineSamplerND
LineSamplerND(UniformRandomProvider rng, LineSampler.LineSamplerND source) - Parameters:
rng- Source of randomness.source- Source to copy.
-
-
Method Details
-
createSample
public double[] createSample(double p1mu, double u) Description copied from class:LineSamplerCreates the sample given the random variateuin the interval[0, 1]. The sum1 - uis provided. The sample can be obtained from the line ab using:p = a(1 - u) + ub
- Specified by:
createSamplein classLineSampler- Parameters:
p1mu- plus 1 minus u (1 - u)u- the variate u- Returns:
- the sample
-
withUniformRandomProvider
Description copied from class:LineSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateObjectSampler<double[]>>- Specified by:
withUniformRandomProviderin classLineSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-