Skip to content

Conversation

@Bureir
Copy link
Contributor

@Bureir Bureir commented Oct 28, 2025


type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:

  • task: lint_filenames status: passed
  • task: lint_editorconfig status: passed
  • task: lint_markdown status: passed
  • task: lint_package_json status: passed
  • task: lint_repl_help status: passed
  • task: lint_javascript_src status: passed
  • task: lint_javascript_cli status: na
  • task: lint_javascript_examples status: passed
  • task: lint_javascript_tests status: passed
  • task: lint_javascript_benchmarks status: passed
  • task: lint_python status: na
  • task: lint_r status: na
  • task: lint_c_src status: na
  • task: lint_c_examples status: na
  • task: lint_c_benchmarks status: na
  • task: lint_c_tests_fixtures status: na
  • task: lint_shell status: na
  • task: lint_typescript_declarations status: passed
  • task: lint_typescript_tests status: passed
  • task: lint_license_headers status: passed

Description

This PR adds @stdlib/stats/base/ndarray/meankbn2, an ndarray wrapper for computing
the arithmetic mean using a second-order Kahan–Babuška algorithm. The ndarray
implementation delegates to the strided meankbn2.ndarray kernel to follow project
conventions and avoid code duplication.

Changes include:

  • lib/main.js: ndarray wrapper delegating to @stdlib/stats/strided/meankbn2.ndarray
  • lib/index.js: module entry
  • README.md: usage, notes, and example updated to meankbn2 with “second-order Kahan–Babuška” phrasing
  • examples/index.js: demonstration script
  • test/test.js: coverage for empty/stride/negative-stride/offset cases
  • benchmark/benchmark.js: length sweep
  • repl.txt: REPL help updated
  • package.json: package name/description and directories
  • docs/types (d.ts): type declarations aligned with API

Related Issues

None.

Questions

Any questions for reviewers of this pull request?

None.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

None.

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

…econd-order Kahan–Babuška algorithm

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. labels Oct 28, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Oct 28, 2025

Coverage Report

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

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

@Bureir
Copy link
Contributor Author

Bureir commented Oct 28, 2025

@kgryte @headlessNode

@kgryte kgryte self-requested a review October 29, 2025 18:10
@kgryte kgryte added Feature Issue or pull request for adding a new feature. and removed Needs Review A pull request which needs code review. labels Oct 29, 2025
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Oct 29, 2025
@kgryte kgryte changed the title feat(stats/base/ndarray/meankbn2): add ndarray implementation using a second-order Kahan–Babuška algorithm feat: add stats/base/ndarray/meankbn2 Oct 29, 2025
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM after minor clean-up.

@kgryte kgryte merged commit 7fd6312 into stdlib-js:develop Oct 29, 2025
13 checks passed
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants