Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7CE841807B for ; Sat, 23 May 2015 13:14:17 +0000 (UTC) Received: (qmail 30796 invoked by uid 500); 23 May 2015 13:14:17 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 30707 invoked by uid 500); 23 May 2015 13:14:17 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 30691 invoked by uid 99); 23 May 2015 13:14:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 May 2015 13:14:17 +0000 Date: Sat, 23 May 2015 13:14:17 +0000 (UTC) From: "Otmar Ertl (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (MATH-1220) More efficient sample() method for ZipfDistribution MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Otmar Ertl updated MATH-1220: ----------------------------- Attachment: Zipf Rejection Inversion Sampling Notes.pdf I attached my notes that should make it clearer how the original algorithm was transformed. > 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 > Fix For: 4.0, 3.6 > > Attachments: Zipf Rejection Inversion Sampling Notes.pdf, patch_v1, patch_v2 > > > 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)