stdlib-js / stdlib-js/stdlib

[RFC]: Add C implementation for `@stdlib/stats/base/dists/lognormal/logpdf`

Đang mở
#3,751 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Accepted C difficulty: 2 Feature Good First Issue priority: Normal RFC Statistics
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### 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/lognormal/logpdf`](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf) package.

When adding support, the following tasks should be completed:

1. A C source implementation should be added to a `src` folder within the package's directory.
2. A native add-on interface should be added in order to call the C implementation from JavaScript.
3. A JavaScript file should be added to the `lib` folder to allow benchmarking and unit testing the native implementation from JavaScript.
4. A new test file should be created which includes unit tests testing against expected behavior.
5. C benchmarks should be added which measure performance for the C source implementation.
6. A file containing C examples should be added to demonstrate example usage.
7. JavaScript benchmarks should be added which measure performance for the native add-on.
8. Build and configuration files should be added to allow compiling and running the C source implementation using project `make` commands (as documented below).
9. 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 https://github.com/stdlib-js/stdlib/pull/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

1. Review JavaScript implementation in `lib/main.js` and its required modules to identify all `stdlib` functions used.
2. Verify C implementations exist for each required function.

### Related Issues

#3355

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

```bash
NODE_ADDONS_PATTERN="@stdlib/stats/base/dists/lognormal/logpdf" make install-node-addons
```

#### Run C examples

```bash
make examples-c-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/examples/c/example.c"
```

#### Run C benchmarks

```bash
make benchmark-c-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/c/benchmark.c"
```

#### Run JavaScript benchmarks

```bash
make benchmark-javascript-files FILES="$(pwd)/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.native.js"
```

#### Run all tests

```bash
make TESTS_FILTER=".*/@stdlib/stats/base/dists/lognormal/logpdf/.*" 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](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) and the associated [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md). Failure to respect project conventions will result in your PR being rejected without review. Thank you for understanding!

### Checklist

- [x] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.
- [x] The issue name begins with `RFC:`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reviewing lib/main.js and its required modules, then compare the expected structure with PR #3354. Verify the required C implementations before adding the src, native add-on, lib, tests, benchmarks, examples, build configuration, and README updates. Done means the listed make commands and the lognormal/logpdf test filter run successfully.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, javascript, nodejs
Lĩnh vực
build-system, documentation, performance, testing, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.