Skip to content

Conversation

shaswata-26
Copy link
Contributor

@shaswata-26 shaswata-26 commented Sep 21, 2025

Resolves #8095

Description

This pull request introduces @stdlib/stats/base/ndarray/meankbn, a function to compute the mean of a one-dimensional ndarray using the improved Kahan–Babuška algorithm, which enhances numerical accuracy for floating-point computations.

Specifically, this PR:

Implements meankbn with support for empty arrays, single-element arrays, non-unit strides, negative strides, and non-zero offsets.

Adds comprehensive tests to verify correctness across various scenarios.

Provides examples demonstrating proper usage of meankbn.

Includes benchmarks to evaluate performance across arrays of different lengths.

Related Issues

Resolves #8095

Questions

No questions for reviewers.

Other

No additional notes.

Checklist

All tests pass: make test TESTS_FILTER="./stats/base/ndarray/meankbn/."

Examples run correctly: make examples EXAMPLES_FILTER="./stats/base/ndarray/meankbn/."

Benchmarks execute successfully: make benchmark BENCHMARKS_FILTER="./stats/base/ndarray/meankbn/."

@stdlib-bot stdlib-bot added 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

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

2 similar comments
@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot
Copy link
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

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

Choose a reason for hiding this comment

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

This file should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hello @kgryte as you say i have to make meankbn for this repo and i have implemented meankbn similarly like mean.
Can you tell me why should i remove them.

Copy link
Member

Choose a reason for hiding this comment

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

a) Because they are incorrect. b) Because no files should be added at the path stats/base/strided/*. That namespace does not exist.

// MODULES //

var main = require( './main.js' );
var ndarray = require( './ndarray.js' ); // you need to create this
Copy link
Member

Choose a reason for hiding this comment

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

@shaswata-26 This sort of comment is a tell-tale that you are using AI. If you are, please don't. Please take the time to actually go through the files by hand. Only once you have sufficiently grokked the codebase and its conventions is it reasonable to consider how to leverage AI for authoring contributions.

@kgryte
Copy link
Member

kgryte commented Sep 21, 2025

@shaswata-26 You need to follow our development guide. You checked the box in your OP, but based on your Git history and the inclusion of various changes which I have to discard for each of your PRs, it is clear that you haven't actually spent time understanding our development process. In that guide, you will find a reference to a Git cheatsheet: https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/git_cheatsheet.md. Please study that before making future contributions.

@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
@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged. 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