Skip to content

Binomcoef function evaluation is not memoized and can take very long to run given large n #2150

@zbenamram

Description

@zbenamram

Description

Encountered an error when evoking binomcoef(n, k) with n = 20000, k=5. The process hangs at 100% cpu utilization.

Computational speed for this call can be increased with memoization.

Here is an example for how it could be implemented:
https://github.com/stevenbunting/stdlib/pull/2/files

Related Issues

Related issues # , # , and # .

Questions

No.

Demo

No response

Reproduction

binomialTest(5, 20000, {
    alpha: 0.05,
    p: 0.05,
    alternative: 'greater'
  });

Expected Results

To complete in a timely manner

Actual Results

Hangs indefinitely

Version

most recent

Environments

N/A

Browser Version

No response

Node.js / npm Version

No response

Platform

No response

Checklist

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working.StatisticsIssue or pull request related to statistical functionality.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions