[RFC]: Add C implementation for @stdlib/stats/base/dists/triangular/mode
#3819
Closed
Description
opened on Dec 13, 2024
Description
This RFC proposes adding a C implementation, including a Node.js native addon, C benchmarks, and C examples, for the @stdlib/stats/base/dists/triangular/mode
package.
When adding support, the following tasks should be completed:
- A C source implementation should be added to a
src
folder within the package's directory. - A native add-on interface should be added in order to call the C implementation from JavaScript.
- A JavaScript file should be added to the
lib
folder to allow benchmarking and unit testing the native implementation from JavaScript. - A new test file should be created which includes unit tests testing against expected behavior.
- C benchmarks should be added which measure performance for the C source implementation.
- A file containing C examples should be added to demonstrate example usage.
- JavaScript benchmarks should be added which measure performance for the native add-on.
- Build and configuration files should be added to allow compiling and running the C source implementation using project
make
commands (as documented below). - The README should be updated to include documentation for the added C API.
To provide a concrete example of what a PR adding the desired method should contain, see #3354, which is a PR adding a C implementation for the CDF of an arcsine distribution. This should provide an idea of what is expected.
Prerequisites
- Review JavaScript implementation in
lib/main.js
and its required modules to identify allstdlib
functions used. - Verify C implementations exist for each required function.
Related Issues
Questions
No.
Other
Once the implementation is ready including C examples and benchmarks, we should be able to run the following make
commands.
Build native add-on
NODE_ADDONS_PATTERN="@stdlib/stats/base/dists/triangular/mode" make install-node-addons
Run C examples
make examples-c-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/triangular/mode/examples/c/example.c"
Run C benchmarks
make benchmark-c-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/triangular/mode/benchmark/c/benchmark.c"
Run JavaScript benchmarks
make benchmark-javascript-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/triangular/mode/benchmark/benchmark.native.js"
Run all tests
make TESTS_FILTER=".*/@stdlib/stats/base/dists/triangular/mode/.*" test
Notes
- If you are interested in contributing a PR which addresses this RFC and are a first-time contributor or not yet familiar with our project conventions, please minimize the submission of LLM-generated code. Please consult our contributing guidelines and the associated development guide. Failure to respect project conventions will result in your PR being rejected without review. Thank you for understanding!
Checklist
- I have read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- The issue name begins with
RFC:
.
Metadata
Assignees
Labels
RFC feature request which has been accepted.Issue involves or relates to C.Issue or pull request for adding a new feature.A good first issue for new contributors!Request for comments. Feature requests and proposed changes.Issue or pull request related to statistical functionality.May require some initial design or R&D, but should be straightforward to resolve and/or implement.Normal priority concern or feature request.
Activity