You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2018/01/26 13:48:00 UTC

[jira] [Commented] (MATH-1370) Increase efficiency of EnumeratedDistribution#probability

    [ https://issues.apache.org/jira/browse/MATH-1370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341076#comment-16341076 ] 

Gilles commented on MATH-1370:
------------------------------

An issue that got lost in the long-standing discussions about the future of "Commons Math".
I seem to have redone the same changes that were proposed here while porting some of the functionality to "Commons RNG" (cf. RNG-47)! :(

Those modifications should still be applied to class {{EnumeratedDistribution}} (but the branch is badly out-of-date after implementing changes proposed in STATISTICS-2.

> 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
>             Fix For: 4.0
>
>         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
(v7.6.3#76005)