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 2015/11/18 12:05:11 UTC

[jira] [Commented] (MATH-1293) Tabulating the logarithmic factorial

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

Gilles commented on MATH-1293:
------------------------------

Thanks for this proposal.
However, for such contributions (that mainly aim at aggressive performance optimization), I'd suggest that a helper class be defined with extensive use of (fully documented) constant declarations.
Future readers will be thankful to be able to quickly figure out what parts of the code they are interested in.


> Tabulating the logarithmic factorial
> ------------------------------------
>
>                 Key: MATH-1293
>                 URL: https://issues.apache.org/jira/browse/MATH-1293
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.5
>            Reporter: Aleksei Dievskii
>            Priority: Minor
>              Labels: feature, patch
>         Attachments: factlog.patch
>
>
> Presently, CombinatoricsUtils#factorialLog is calculated via a tabulated value for the first 21 entries, and for the rest it employs linear-complexity direct summing. For the factorial-heavy computations this can be rather painful. I propose a patch which allocates additional 16KB of tabulated log-factorial values, allowing very fast (constant complexity) computation for arguments up to 17000, and delegating to the log-gamma for the rest. Benchmarks show a speed-up of up to 200x.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)