Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add stats/base/ndarray/meankbn #8116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Bureir wants to merge 5 commits into stdlib-js:develop
base: develop
Choose a base branch
Loading
from Bureir:feat-ndarray-meankbn

Conversation

Copy link

@Bureir Bureir commented Sep 21, 2025
edited
Loading

Resolves #8095

Description

What is the purpose of this pull request?

This pull request:

  • adds @stdlib/stats/base/ndarray/meankbn, an ndarray wrapper around @stdlib/stats/strided/meankbn implementing the improved Kahan–Babuška compensation algorithm;
  • mirrors the API and behavior of @stdlib/stats/base/ndarray/mean (supports empty and singleton inputs, non-unit and negative strides, and non-zero offsets);
  • includes comprehensive unit tests adapted from ndarray/mean, plus a numerics test demonstrating improved conditioning on [1e16, 1, -1e16];
  • adds an example and a benchmark;
  • adds README and docs (types, REPL transcript, and equation SVG).

Related Issues

Does this pull request have any related issues?

This pull request:

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.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Sep 21, 2025
Copy link
Contributor

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Getting Started

Next Steps

  1. A project maintainer will approve GitHub Actions workflows for your PR.
  2. All CI checks must pass before your submission can be fully reviewed.
  3. You'll need to address any failures in linting or unit tests.

Running Tests Locally

You can use make to run any of the CI commands locally from the root directory of the stdlib repository:

# Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"
# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"

If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR.

If you have any further questions while waiting for a response, please join our Gitter channel to chat with project maintainers and other community members.

We appreciate your contribution!

Documentation Links

@stdlib-bot stdlib-bot added First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Sep 21, 2025
Copy link
Contributor

stdlib-bot commented Sep 21, 2025
edited
Loading

Coverage Report

Package Statements Branches Functions Lines
stats/base/ndarray/meankbn $\color{green}95/95$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}95/95$
$\color{green}+100.00\%$

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

Bureir reacted with laugh emoji

@kgryte kgryte changed the title (削除) feat(stats/base/ndarray): add meankbn (improved Kahan Babuska) ndarray wrapper (削除ここまで) (追記) feat: add stats/base/ndarray/meankbn (追記ここまで) Sep 21, 2025
@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Sep 21, 2025
Copy link
Author

Bureir commented Sep 21, 2025
edited
Loading

Addressed review feedback: updated README, aligned index.js and example with project conventions, and normalized package.json. Tests and example pass locally. PTAL.

@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Sep 22, 2025
Copy link
Author

@Bureir Bureir left a comment
edited
Loading

Choose a reason for hiding this comment

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

Thanks for the quick review! I’ve aligned the new package with project conventions by:

  • Rewriting the README to match the structure of sibling packages (Usage / Notes / Examples / See Also), fixed code fences and wording, and clarified the ndarray call shape.

  • Updating index.js and lib/index.js to include license headers, module JSDoc, and proper re-export of ./lib.

  • Making the example build a typed ndarray and print the result (mirrors ndarray/mean style).

  • Normalizing package.json fields (name, description, license, main, keywords).

  • Verifying tests/examples/benchmarks pass locally for this package.

If there are any remaining convention nits (section order, phrasing, example format, or types), I’m happy to adjust. PTAL, thanks!

@Bureir Bureir requested a review from kgryte September 22, 2025 04:58
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@kgryte kgryte Awaiting requested review from kgryte

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
First-time Contributor A pull request from a contributor who has never previously committed to the project repository. 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. Potential Duplicate There might be another pull request resolving the same issue. Statistics Issue or pull request related to statistical functionality.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[RFC]: add stats/base/ndarray/meankbn

AltStyle によって変換されたページ (->オリジナル) /