Skip to content

Conversation

@DivyanshuVortex
Copy link
Contributor

@DivyanshuVortex DivyanshuVortex commented Jan 5, 2026


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

Resolves : none

Description

What is the purpose of this pull request?

This pull request:

  • feat: add stats/base/ndarray/sstdevwe

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • #{{TODO: add related issue number}}

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.

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.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

---
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 the Statistics Issue or pull request related to statistical functionality. label Jan 5, 2026
@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 Needs Review A pull request which needs code review. label Jan 5, 2026
---
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: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - 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
---
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Jan 5, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/ndarray/sstdevwd $\color{green}124/124$
$\color{green}+0.00%$
$\color{green}3/3$
$\color{green}+0.00%$
$\color{green}1/1$
$\color{green}+0.00%$
$\color{green}124/124$
$\color{green}+0.00%$

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

---
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: na
  - 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
---
@DivyanshuVortex DivyanshuVortex changed the title feat: add stats/base/ndarray/sstdevwe feat: add stats/base/ndarray/sstdevwd Jan 5, 2026
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

PR is in good shape; thanks!

Left one comment that should be addressed.

correction = scalar2ndarray( 1.0, opts );

v = sstdevwd( [ vector( x, x.length, 1, 0 ), correction ] );
v = sstdevwd( [ vector( x, x.length, 1, 0 ), correction ] );
Copy link
Member

Choose a reason for hiding this comment

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

Duplicate function call. This line is identical to the one above and appears to be a copy-paste error. The same issue exists on lines 85-86.

Suggested change
v = sstdevwd( [ vector( x, x.length, 1, 0 ), correction ] );

@Planeshifter Planeshifter added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Jan 8, 2026
---
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: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - 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
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jan 8, 2026
Copy link
Member

@Planeshifter Planeshifter 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 your PR! A few requests, otherwise looks good to me.


var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
Copy link
Member

Choose a reason for hiding this comment

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

Single-precision packages should use isnanf instead of isnan.

Suggested change
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = sstdevwd( [ x, correction ] );
if ( isnan( v ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

This should be isnanf to match the single-precision import above.

Suggested change
if ( isnan( v ) ) {
if ( isnanf( v ) ) {

}
}
b.toc();
if ( isnan( v ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Same here - use isnanf for consistency.

Suggested change
if ( isnan( v ) ) {
if ( isnanf( v ) ) {


#### sstdevwd( arrays )

Computes the [standard deviation][standard-deviation] of a one-dimensional single-precision floating-point ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

The function description should include "using Welford's algorithm" to be consistent with the H1 title (line 23) and the JSDoc in lib/main.js (line 34).

Suggested change
Computes the [standard deviation][standard-deviation] of a one-dimensional single-precision floating-point ndarray.
Computes the [standard deviation][standard-deviation] of a one-dimensional single-precision floating-point ndarray using Welford's algorithm.

'use strict';

/**
* Compute the standard deviation of a one-dimensional single-precision floating-point ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

The module description should include "using Welford's algorithm" to be consistent with lib/main.js (line 34).

Suggested change
* Compute the standard deviation of a one-dimensional single-precision floating-point ndarray.
* Compute the standard deviation of a one-dimensional single-precision floating-point ndarray using Welford's algorithm.

import { float32ndarray, typedndarray } from '@stdlib/types/ndarray';

/**
* Computes the standard deviation of a one-dimensional single-precision floating-point ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

The function description should include "using Welford's algorithm" to be consistent with the package title and lib/main.js.

Suggested change
* Computes the standard deviation of a one-dimensional single-precision floating-point ndarray.
* Computes the standard deviation of a one-dimensional single-precision floating-point ndarray using Welford's algorithm.

Comment on lines 3 to 4
Computes the standard deviation of a one-dimensional single-precision
floating-point ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

The function description should include "using Welford's algorithm" to be consistent with the package title and lib/main.js.

Suggested change
Computes the standard deviation of a one-dimensional single-precision
floating-point ndarray.
Computes the standard deviation of a one-dimensional single-precision
floating-point ndarray using Welford's algorithm.

@Planeshifter Planeshifter removed the Needs Review A pull request which needs code review. label Jan 10, 2026
@DivyanshuVortex
Copy link
Contributor Author

@Planeshifter, I’m not sure why this lint check is failing. Could you please take a look and let me know what’s going wrong? Also, I’d appreciate any guidance on how to avoid this for my upcoming contributions.

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

@DivyanshuVortex The EditorConfig linter tool cannot be installed for some reason. Unrelated to your changes here. We meant to look into reworking this to avoid re-downloading it in each lint run for a while. Please ignore for the time being if that job fails due to the installation failing.

PR looks good, so I will go ahead and merge. Thanks!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Jan 10, 2026
@stdlib-bot stdlib-bot removed the Needs Changes Pull request which needs changes before being merged. label Jan 10, 2026
@stdlib-bot
Copy link
Contributor

PR Commit Message

feat: add `stats/base/ndarray/sstdevwd`

PR-URL: https://github.com/stdlib-js/stdlib/pull/9565

Reviewed-by: Philipp Burckhardt <[email protected]>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit 88f0620 into stdlib-js:develop Jan 10, 2026
30 of 33 checks passed
@stdlib-bot stdlib-bot removed the Ready To Merge A pull request which is ready to be merged. label Jan 10, 2026
@DivyanshuVortex
Copy link
Contributor Author

Ohh, I was a bit tense seeing that error and thought it might be something on my end. Thanks for confirming; that makes sense. I’ll ignore the EditorConfig lint job for now and proceed accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants