Skip to content

feat: add C implementation for stats/base/dists/erlang/pdf#10554

Open
rautelaKamal wants to merge 1 commit intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/erlang/pdf-c-port
Open

feat: add C implementation for stats/base/dists/erlang/pdf#10554
rautelaKamal wants to merge 1 commit intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/erlang/pdf-c-port

Conversation

@rautelaKamal
Copy link
Contributor

@rautelaKamal rautelaKamal commented Feb 27, 2026

Ref #3575.

Description

What is the purpose of this pull request?

This pull request:

  • Adds a C implementation for @stdlib/stats/base/dists/erlang/pdf, fulfilling the open RFC [RFC]: Add C implementation for @stdlib/stats/base/dists/erlang/pdf #3575.
  • Validates that the shape parameter k is a non-negative integer using stdlib_base_is_nonnegative_integer(k).
  • Reuses the existing Gamma distribution implementation by safely proxying the evaluation directly to the stdlib_base_dists_gamma_pdf C function, since the Erlang distribution is mathematically a special case of the Gamma distribution.
  • Integrates standard N-API bindings, Makefile, include.gypi, binding.gyp, and the native.js benchmarks & tests.

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.".

I utilized an AI coding assistant to help scaffold the C implementations, N-API bindings, makefiles, and native benchmarks. The logic was reviewed and verified manually to ensure mathematical correctness and alignment with standard project practices.


@stdlib-js/reviewers

@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 27, 2026
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 27, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/erlang/pdf $\color{green}289/289$
$\color{green}+100.00%$
$\color{green}11/11$
$\color{green}+100.00%$
$\color{green}3/3$
$\color{green}+100.00%$
$\color{green}289/289$
$\color{green}+100.00%$

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

@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/pdf-c-port branch 4 times, most recently from 7705db9 to a9a7359 Compare February 27, 2026 23:09
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/pdf-c-port branch from a9a7359 to 37e1576 Compare February 27, 2026 23:54
@Om-A-osc
Copy link
Contributor

@rautelaKamal
CI checks failing for package.json.
Order of keys is important for package.json linting. Maybe have a look at lib/node_modules/@stdlib/stats/base/dists/erlang/mean/package.json and try rearranging.

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 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.

3 participants