[ 
https://issues.apache.org/jira/browse/RNG-149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17373527#comment-17373527
 ] 

Alex Herbert commented on RNG-149:
----------------------------------

I have created a version based on the ZigguratNormalizedGaussianSampler.

I added this to the JMH examples and ran using:

{noformat}
mvn package -Pexamples-jmh
java -jar target/examples-jmh.jar \
    ContinuousSamplersPerformance -p \
    samplerType=AhrensDieterExponentialSampler,ZigguratExponentialSampler \
    -p randomSourceName=XO_RO_SHI_RO_128_PP
{noformat}

The speed of the Ziggurat sampler is much faster (4x) than the current 
AhrensDieterExponentialSampler:

||Sampler||Score||Error||
|Baseline|2.434|0.060|
|AhrensDieterExponentialSampler|24.788|0.329|
|ZigguratExponentialSampler|7.450|0.101|




> ZigguratExponentialSampler
> --------------------------
>
>                 Key: RNG-149
>                 URL: https://issues.apache.org/jira/browse/RNG-149
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: sampling
>    Affects Versions: 1.4
>            Reporter: Alex Herbert
>            Priority: Major
>
> The paper describing the ZigguratNormalizedGaussianSampler also provides code 
> for sampling from an exponential distribution.
> {code:java}
> public class ZigguratExponentialSampler implements 
> SharedStateContinuousSampler {
>     public ZigguratExponentialSampler
>         withUniformRandomProvider(UniformRandomProvider rng);
>     public static ZigguratExponentialSampler of(UniformRandomProvider rng);
>     public static ZigguratExponentialSampler of(UniformRandomProvider rng, 
> double mean);
> }
> {code}
> I suggest allowing creation of a sampler with mean 1. This special case has 
> application in other samplers, for example the LargeMeanPoissonSampler.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to