Skip to content

feat: add C implementation for @stdlib/stats/base/ndarray/dmeanli - #13826

Merged
kgryte merged 6 commits into
stdlib-js:developfrom
ujjwalv01:feat-stats-base-ndarray-dmeanli-c
Aug 7, 2026
Merged

kgryte merged 6 commits into
stdlib-js:developfrom
ujjwalv01:feat-stats-base-ndarray-dmeanli-c

Conversation

@ujjwalv01

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Adds a C implementation (Native Addon) for @stdlib/stats/base/ndarray/dmeanli.
  • Ports the Native Addon architecture from @stdlib/stats/base/ndarray/dmean to dmeanli, routing the C computation to stdlib_strided_dmeanli_ndarray.
  • Updates lib/index.js with tryRequire logic to safely load the native implementation and fallback to pure JavaScript when necessary.
  • Adds native tests (test.native.js) and native benchmarks to match the JavaScript implementations.
  • Begins addressing the backlog of stats/base/ndarray packages missing C implementations.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • N/A

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


@stdlib-js/reviewers

@ujjwalv01
ujjwalv01 requested a review from a team August 1, 2026 08:20
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Aug 1, 2026
@stdlib-bot

stdlib-bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/ndarray/dmeanli $\\color{green}176/176$
$\\color{green}+2.92\\%$
$\\color{green}7/7$
$\\color{green}+25.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}176/176$
$\\color{green}+2.92\\%$

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

@ujjwalv01
ujjwalv01 force-pushed the feat-stats-base-ndarray-dmeanli-c branch from 5f01175 to dd190ed Compare August 1, 2026 08:41
@kgryte kgryte added Feature Issue or pull request for adding a new feature. C Issue involves or relates to C. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. and removed Needs Review A pull request which needs code review. labels Aug 7, 2026
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/dmeanli/lib/native.js Outdated
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/dmeanli/src/main.c Outdated

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.

You need to copy test.js to test.main.js and then you need to add a new test.js file which tests for export behavior. See stats/base/ndarray/dmeankbn.

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>

@kgryte kgryte left a comment

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.

Apart from the missing tests and C documentation in the README, this PR is coming along. See stats/base/ndarray/dmeankbn for what is expected for both the tests and docs.

@kgryte kgryte added review: 3 Needs Changes Pull request which needs changes before being merged. labels Aug 7, 2026
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/dmeanli/test/test.main.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/dmeanli/README.md Outdated
Comment thread lib/node_modules/@stdlib/stats/base/ndarray/dmeanli/README.md Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>

@kgryte kgryte left a comment

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.

LGTM

@kgryte kgryte removed the Needs Changes Pull request which needs changes before being merged. label Aug 7, 2026
@kgryte
kgryte merged commit 9e08b03 into stdlib-js:develop Aug 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Issue involves or relates to C. difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Feature Issue or pull request for adding a new feature. review: 3 Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants