[
https://issues.apache.org/jira/browse/MATH-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14521921#comment-14521921
]
Otmar Ertl commented on MATH-1220:
----------------------------------
Since we are sampling from a finite number of points, convergence of the
infinite series is irrelevant. Exponent equal to 0 corresponds to a uniform
distribution.
Yes, the tail includes the points starting from 2 to N, because the first point
(the head) is treated differently in order to limit the rejection rate.
Otherwise, the rejection rate could become arbitrarily large for large
exponents.
> 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)