Skip to content

feat: add C implementation for stats/base/dists/erlang/logpdf#10719

Open
rautelaKamal wants to merge 3 commits intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/erlang/logpdf-c-port
Open

feat: add C implementation for stats/base/dists/erlang/logpdf#10719
rautelaKamal wants to merge 3 commits intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/erlang/logpdf-c-port

Conversation

@rautelaKamal
Copy link
Copy Markdown
Contributor

@rautelaKamal rautelaKamal commented Mar 5, 2026

This PR adds a C implementation for @stdlib/stats/base/dists/erlang/logpdf.

Closes #3571

Changes

  • Added src/addon.c: Node.js native addon entry point

    • Added src/main.c: C implementation delegating to stdlib_base_dists_gamma_logpdf
    • Added include/stdlib/stats/base/dists/erlang/logpdf.h: C header file
    • Added lib/native.js: JavaScript wrapper for native addon
    • Added benchmark/benchmark.native.js: Native benchmark
    • Added manifest.json: Build manifest
    • Updated package.json: Added gypfile, include, and src directories
  • Read, understood, and followed the contributing guidelines

AI Assistance

  • I have used AI-assisted tools for some of the changes in this PR.

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Mar 5, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 5, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Mar 5, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/erlang/logpdf $\color{green}246/246$
$\color{green}+0.00%$
$\color{green}11/11$
$\color{green}+0.00%$
$\color{green}3/3$
$\color{green}+0.00%$
$\color{green}246/246$
$\color{green}+0.00%$

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

@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/logpdf-c-port branch 5 times, most recently from 55dc671 to b76bc1a Compare April 4, 2026 18:08
@github-actions github-actions bot mentioned this pull request Apr 4, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/logpdf-c-port branch 4 times, most recently from 2b8636f to 93de059 Compare April 12, 2026 07:00
@kgryte kgryte added difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. review: 5 and removed Needs Review A pull request which needs code review. labels Apr 12, 2026
@kgryte kgryte changed the title feat: add C implementation for @stdlib/stats/base/dists/erlang/logpdf feat: add C implementation for stats/base/dists/erlang/logpdf Apr 12, 2026
var i;

len = 100;
x = new Float64Array( len );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should go ahead and migrate to using random/array/uniform and random/array/discrete-uniform directly, as done in other dists packages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've migrated the benchmarks to use random/array/uniform and random/array/discrete-uniform in the latest push. This PR should be ready for re-review.

t.strictEqual( y, expected[i], 'x: '+x[i]+', k: '+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[ i ] );
tol = 450.0 * EPS * abs( expected[ i ] );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should go ahead and use isAlmostSameValue for ULP-based testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've migrated the tests to use isAlmostSameValue for ULP-based testing in the latest push. This PR should be ready for re-review.

@kgryte kgryte added review: 4 Needs Changes Pull request which needs changes before being merged. and removed review: 5 labels Apr 12, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/logpdf-c-port branch from 93de059 to 7a15449 Compare April 13, 2026 07:08
@rautelaKamal rautelaKamal changed the title feat: add C implementation for stats/base/dists/erlang/logpdf feat: add C implementation for stats/base/dists/erlang/logpdf Apr 13, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/erlang/logpdf-c-port branch from 7a15449 to 54bf6dd Compare April 13, 2026 07:51
@rautelaKamal rautelaKamal requested a review from a team April 20, 2026 13:14
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 20, 2026
@rautelaKamal rautelaKamal requested a review from kgryte April 20, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. 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. review: 4 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/erlang/logpdf

3 participants