Skip to content

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

@gururaj1512

Description

@gururaj1512

Description

Add @stdlib/stats/base/ndarray/meankbn, analogous to @stdlib/stats/base/ndarray/mean, but computing the mean using the improved Kahan–Babuška algorithm.

Key Points

When implementing this package, you'll need to do the following:

Create package files

To see examples of similar packages, refer to:

Notice that @stdlib/stats/base/ndarray/mean is a thin wrapper around @stdlib/stats/strided/mean. Similarly, this proposed package should be a thin wrapper around @stdlib/stats/strided/meankbn.

⚠ Important: This package should be implemented by replicating the structure and behavior of stats/base/ndarray/mean. Do not simply copy-paste code without reasoning about API design and expected behavior.

Update source files

Once you've created package files, proceed to update all tests, documentation, and examples to reflect the API and expected behavior for the package. You should spend some time studying the tests in @stdlib/stats/base/ndarray/mean. We expect this package to have equivalent and fully comprehensive tests. The primary difference will be in the use of the improved Kahan–Babuška algorithm.

To see an example of what is expected, study the tests in

Compare and contrast the tests in that pair of packages.

Run tests and other commands

For each of the following commands, please run them from the root stdlib repository directory (not the package folder!).

To run unit tests,

make test TESTS_FILTER=".*/stats/base/ndarray/meankbn/.*"

To run examples,

make examples EXAMPLES_FILTER=".*/stats/base/ndarray/meankbn/.*"

To run benchmarks,

make benchmark BENCHMARKS_FILTER=".*/stats/base/ndarray/meankbn/.*"

Create pull request

When creating a PR:

  • PR Title: feat: add stats/base/ndarray/meankbn
  • Ensure tests, examples, and benchmarks all pass.
  • Ensure documentation follows project conventions.

Notes

  • If you are interested in contributing a PR which addresses this RFC and still getting familiar with our project conventions, please do not submit 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

Metadata

Assignees

No one assigned

    Labels

    FeatureIssue or pull request for adding a new feature.Good First IssueA good first issue for new contributors!JavaScriptIssue involves or relates to JavaScript.RFCRequest for comments. Feature requests and proposed changes.StatisticsIssue or pull request related to statistical functionality.priority: NormalNormal priority concern or feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions