[
https://issues.apache.org/jira/browse/RNG-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert updated RNG-133:
-----------------------------
Description:
Create a sampler to sample uniformly within a line:
{code:java}
public abstract class LineSampler implements
SharedStateSampler<LineSampler> {
public static LineSampler of(double[] a,
double[] b,
UniformRandomProvider rng);
}
{code}
Sampling can be performed using the same method as the TriangleSampler without
the third coordinate:
{noformat}
v = b - a
p = a + s * v
with s a uniform deviate in [0, 1]
{noformat}
To allow computation with any finite coordinates the vector does not require
computation:
{noformat}
p = a + s * (b - a)
= a + sb - sa
= (1 - s)a + sb
{noformat}
This is the same method used in the {{ContinuousUniformSampler}} but extended
to N-dimensions.
was:
Create a sampler to sample uniformly within a line:
{code:java}
public abstract class LineSampler implements
SharedStateSampler<LineSampler> {
public static LineSampler of(double[] a,
double[] b,
UniformRandomProvider rng);
}
{code}
Sampling can be performed using the same method as the TriangleSampler without
the third coordinate:
{noformat}
v = b - a
p = a + s * v
with s a uniform deviate in [0, 1]
{noformat}
To allow computation with any finite coordinates the vector does not require
computation:
{noformat}
p = a + s * (b - a)
= a + sb - sa
= (1 - s)a + sb
{noformat}
This is the same method used in the {{ContinuousUniformSampler}} but extended
to N-dimensions.
> LineSampler: Sample uniformly within a line
> -------------------------------------------
>
> Key: RNG-133
> URL: https://issues.apache.org/jira/browse/RNG-133
> Project: Commons RNG
> Issue Type: New Feature
> Components: sampling
> Affects Versions: 1.4
> Reporter: Alex Herbert
> Priority: Minor
> Fix For: 1.4
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Create a sampler to sample uniformly within a line:
> {code:java}
> public abstract class LineSampler implements
> SharedStateSampler<LineSampler> {
> public static LineSampler of(double[] a,
> double[] b,
> UniformRandomProvider rng);
> }
> {code}
> Sampling can be performed using the same method as the TriangleSampler
> without the third coordinate:
> {noformat}
> v = b - a
> p = a + s * v
> with s a uniform deviate in [0, 1]
> {noformat}
> To allow computation with any finite coordinates the vector does not require
> computation:
> {noformat}
> p = a + s * (b - a)
> = a + sb - sa
> = (1 - s)a + sb
> {noformat}
> This is the same method used in the {{ContinuousUniformSampler}} but extended
> to N-dimensions.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)