You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2015/05/01 13:28:06 UTC
[jira] [Comment Edited] (MATH-1220) More efficient sample() method
for ZipfDistribution
[ https://issues.apache.org/jira/browse/MATH-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14523065#comment-14523065 ]
Thomas Neidhart edited comment on MATH-1220 at 5/1/15 11:27 AM:
----------------------------------------------------------------
Committed to 3.6 branch in commit 321269ed9aa84d15b18296ee6e73d53489efb622.
Changed the contributed code to a static inner class and make the sampler a transient field in the distribution which is initialized at first use to avoid problems wrt serialization.
was (Author: tn):
Committed to 3.6 branch in commit 321269ed9aa84d15b18296ee6e73d53489efb622.
> More efficient sample() method for ZipfDistribution
> ---------------------------------------------------
>
> Key: MATH-1220
> URL: https://issues.apache.org/jira/browse/MATH-1220
> Project: Commons Math
> Issue Type: Improvement
> Reporter: Otmar Ertl
> Attachments: patch_v1
>
>
> Currently, sampling from a ZipfDistribution is very inefficient. Random values are generated by inverting the CDF. However, the current implementation uses O(N) power function evaluations to calculate the CDF for some point. (Here N is the number of points of the Zipf distribution.) I propose to use rejection sampling instead, which allows the generation of a single random value in constant time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)