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

private static final class LineSampler.LineSamplerND extends LineSampler
Sample uniformly from a line in ND.
  • Field Details

    • a

      private final double[] a
      The first vertex.
    • b

      private final double[] b
      The second vertex.
  • Constructor Details

  • Method Details

    • createSample

      public double[] createSample(double p1mu, double u)
      Description copied from class: LineSampler
      Creates the sample given the random variate 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
       
      Specified by:
      createSample in class LineSampler
      Parameters:
      p1mu - plus 1 minus u (1 - u)
      u - the variate u
      Returns:
      the sample
    • withUniformRandomProvider

      public LineSampler withUniformRandomProvider(UniformRandomProvider rng)
      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 interface SharedStateSampler<SharedStateObjectSampler<double[]>>
      Specified by:
      withUniformRandomProvider in class LineSampler
      Parameters:
      rng - Generator of uniformly distributed random numbers.
      Returns:
      the sampler