Skip to content

feat(stats): add C implementation for stats/base/dists/hypergeometric/kurtosis#10360

Open
whizzel wants to merge 3 commits intostdlib-js:developfrom
whizzel:hypergeometric-kurtosis
Open

feat(stats): add C implementation for stats/base/dists/hypergeometric/kurtosis#10360
whizzel wants to merge 3 commits intostdlib-js:developfrom
whizzel:hypergeometric-kurtosis

Conversation

@whizzel
Copy link
Copy Markdown
Contributor

@whizzel whizzel commented Feb 19, 2026

Resolves #3660 .

Description

What is the purpose of this pull request?

This pull request:

  • Adds a C implementation of the excess kurtosis of a hypergeometric distribution.
  • Includes benchmarks for the C implementation.
  • Provides examples demonstrating the usage of the excess kurtosis of a hypergeometric distribution in C.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

…/kurtosis

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Feb 19, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Feb 19, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/hypergeometric/kurtosis $\color{green}207/207$
$\color{green}+0.00%$
$\color{green}13/13$
$\color{green}+0.00%$
$\color{green}2/2$
$\color{green}+0.00%$
$\color{green}207/207$
$\color{green}+0.00%$

The above coverage report was generated for the changes in this PR.

Copy link
Copy Markdown
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

Comment thread lib/node_modules/@stdlib/stats/base/dists/hypergeometric/kurtosis/src/main.c Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/hypergeometric/kurtosis/manifest.json Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/hypergeometric/kurtosis/manifest.json Outdated
Comment thread lib/node_modules/@stdlib/stats/base/dists/hypergeometric/kurtosis/manifest.json Outdated
@Planeshifter Planeshifter added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Mar 4, 2026
@whizzel whizzel requested a review from Planeshifter March 8, 2026 15:46
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 8, 2026
@rautelaKamal
Copy link
Copy Markdown
Contributor

Hey @ivishal-g, great job adding the C implementation! I took a look at the logic and the edge cases.

Since the variance of the hypergeometric distribution goes to zero when K = 0, K = N, n = 0, or n = N (meaning the kurtosis is undefined / NaN), your checks for K <= 0.0, n <= 0.0, K >= N, and n >= N in main.c perfectly handle those boundary conditions returning NaN.

I noticed @Planeshifter asked for a few cleanup items in his review (like changing t.ok to t.strictEqual( isnan(y), true, ... ) in the tests, fixing the copy-pasted K test block, and removing the unused pinf / floor dependencies from manifest.json).

If you need any help fixing those tests or modifying the manifest.json, feel free to ping me here! Happy to help you get this merged. 🚀

@whizzel
Copy link
Copy Markdown
Contributor Author

whizzel commented Mar 8, 2026

thank you @rautelaKamal,

I’ve addressed the cleanup points you mentioned — updated the tests to use t.strictEqual( isnan(y), true ), fixed the copy-pasted K test block, and removed the unused pinf / floor dependencies from manifest.json.

Feel free to take another look at the latest commit to see how I handled those changes. Let me know if anything else needs improvement.

Copilot AI review requested due to automatic review settings April 9, 2026 11:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: Add C implementation for @stdlib/stats/base/dists/hypergeometric/kurtosis

5 participants