feat: add C implementation for stats/base/dists/erlang/logpdf#10719
feat: add C implementation for stats/base/dists/erlang/logpdf#10719rautelaKamal wants to merge 9 commits into
stats/base/dists/erlang/logpdf#10719Conversation
|
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:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
Coverage ReportNo coverage information available. |
55dc671 to
b76bc1a
Compare
2b8636f to
93de059
Compare
stats/base/dists/erlang/logpdf
93de059 to
7a15449
Compare
stats/base/dists/erlang/logpdf7a15449 to
54bf6dd
Compare
stats/base/dists/erlang/logpdf
|
Note:- For this PR I went ahead and modernized the existing JS benchmarks and tests to follow the latest code conventions. |
| if ( !stdlib_base_is_nonnegative_integer( k ) ) { | ||
| return 0.0 / 0.0; // NaN | ||
| } | ||
| return stdlib_base_dists_gamma_logpdf( x, k, lambda ); |
There was a problem hiding this comment.
since gamma/logpdf accurately handles edge cases for the 2nd and 3rd argument which is k and lambda in this case. For ex:- lambda <= 0.0 should return NaN.
I removed the previous unwanted checks to validate if k is NaN and sp on!!
| delta = abs( y - expected[ i ] ); | ||
| tol = 450.0 * EPS * abs( expected[ i ] ); | ||
| t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); | ||
| t.ok( isAlmostSameValue( y, expected[i], 700 ), 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'.' ); |
There was a problem hiding this comment.
These test cases are expected to have huge-diffs due to the large values of generated fixtures. Something, which was previously done for other packages in math namespace.
|
Since the lint faliure is not due to changes associated with this PR I'll go ahead and request up a review!! |
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 pointsrc/main.c: C implementation delegating tostdlib_base_dists_gamma_logpdfinclude/stdlib/stats/base/dists/erlang/logpdf.h: C header filelib/native.js: JavaScript wrapper for native addonbenchmark/benchmark.native.js: Native benchmarkmanifest.json: Build manifestpackage.json: Addedgypfile,include, andsrcdirectoriesRead, understood, and followed the contributing guidelines
AI Assistance