Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7D6272009C6 for ; Tue, 31 May 2016 14:16:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7C2FF160A46; Tue, 31 May 2016 12:16:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F10B7160A11 for ; Tue, 31 May 2016 14:16:13 +0200 (CEST) Received: (qmail 11937 invoked by uid 500); 31 May 2016 12:16:13 -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 11919 invoked by uid 99); 31 May 2016 12:16:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 12:16:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CC0012C1F5A for ; Tue, 31 May 2016 12:16:12 +0000 (UTC) Date: Tue, 31 May 2016 12:16:12 +0000 (UTC) From: "Ryan Gaffney (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (MATH-1370) Increase efficiency of EnumeratedDistribution#probability MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 31 May 2016 12:16:14 -0000 [ https://issues.apache.org/jira/browse/MATH-1370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307633#comment-15307633 ] Ryan Gaffney edited comment on MATH-1370 at 5/31/16 12:15 PM: -------------------------------------------------------------- Had a couple nit comments, besides that looks good. Thanks! was (Author: rg_): Had one nit comment, besides that looks good. Thanks! > Increase efficiency of EnumeratedDistribution#probability > --------------------------------------------------------- > > Key: MATH-1370 > URL: https://issues.apache.org/jira/browse/MATH-1370 > Project: Commons Math > Issue Type: Improvement > Reporter: Ryan Gaffney > Priority: Minor > Labels: patch, performance > Attachments: enum-distribution-perf-patch, enum-distribution-perf-patch.2 > > > There are lots of other low hanging fruit in the distribution package but unfortunately this is the only one I got to that day. > In the EnumeratedDistribution case, the probability() method is currently O(N) where N denotes number of random variables, even though the random variables are fixed / known. This change makes probability() O(1). The unlikely worst case scenario now consumes slightly more than 2x the memory, but I do not think this would be an issue in the vast majority of cases. > Original PR (incorrectly against master) [here|https://github.com/apache/commons-math/pull/34]. -- This message was sent by Atlassian JIRA (v6.3.4#6332)