Skip to content

Conversation

Bureir
Copy link

@Bureir Bureir commented Sep 21, 2025

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
@stdlib-bot
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
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Sep 21, 2025

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.

@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
@Bureir
Copy link
Author

Bureir commented Sep 21, 2025

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

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

Successfully merging this pull request may close these issues.

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