commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-1370) Increase efficiency of EnumeratedDistribution#probability
Date Tue, 31 May 2016 09:20:12 GMT


Gilles commented on MATH-1370:

Thanks for confirming.

bq. It is also testing the getPmf() function which is specific to EnumeratedDistribution

IIUC {{getPmf}} is indirectly tested in tests for {{EnumeratedIntegerDistribution}} and {{EnumeratedRealDistribution}}
since it is called from several methods in those classes.

It does not hurt to have additional tests but it is clearer to limit their scope to a single

I've created branch "feature-MATH-1370".  Please have a look and let me know whether everything
is OK for you.

> Increase efficiency of EnumeratedDistribution#probability
> ---------------------------------------------------------
>                 Key: MATH-1370
>                 URL:
>             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
> Original PR (incorrectly against master) [here|].

This message was sent by Atlassian JIRA

View raw message