feat: add stats/base/ndarray/snanvariance#9841
feat: add stats/base/ndarray/snanvariance#9841aryan7071 wants to merge 7 commits intostdlib-js:developfrom
stats/base/ndarray/snanvariance#9841Conversation
---
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
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
/stdlib update-copyright-years |
---
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
---
stats/base/ndarray/snanvariance
Planeshifter
left a comment
There was a problem hiding this comment.
Thanks! Looks good; left a few minor documentation suggestions.
|
|
||
| # snanvariance | ||
|
|
||
| > Compute the sample variance of a one-dimensional ndarray, ignoring `NaN` values. |
There was a problem hiding this comment.
This package specifically operates on single-precision floating-point arrays (float32), so let's add that qualifier to match the pattern in similar packages like snanmean.
| > Compute the sample variance of a one-dimensional ndarray, ignoring `NaN` values. | |
| > Compute the sample variance of a one-dimensional single-precision floating-point ndarray, ignoring `NaN` values. |
|
|
||
| #### snanvariance( arrays, correction ) | ||
|
|
||
| Computes the sample variance of a one-dimensional ndarray, ignoring NaN values. |
There was a problem hiding this comment.
Two things here: missing backticks around NaN and the type qualifier. Let's match the snanmean convention.
| Computes the sample variance of a one-dimensional ndarray, ignoring NaN values. | |
| Computes the sample variance of a one-dimensional single-precision floating-point ndarray, ignoring `NaN` values. |
| 'use strict'; | ||
|
|
||
| /** | ||
| * Compute the sample variance of a one-dimensional ndarray, ignoring `NaN` values. |
There was a problem hiding this comment.
Let's add the "single-precision floating-point" qualifier here too to match the established pattern.
| * Compute the sample variance of a one-dimensional ndarray, ignoring `NaN` values. | |
| * Compute the sample variance of a one-dimensional single-precision floating-point ndarray, ignoring `NaN` values. |
| // MAIN // | ||
|
|
||
| /** | ||
| * Computes the sample variance of a one-dimensional ndarray, ignoring `NaN` values. |
There was a problem hiding this comment.
Let's add the type qualifier here as well.
| * Computes the sample variance of a one-dimensional ndarray, ignoring `NaN` values. | |
| * Computes the sample variance of a one-dimensional single-precision floating-point ndarray, ignoring `NaN` values. |
| function vector( buffer, length, stride, offset ) { | ||
| return new ndarray( 'float32', buffer, [ length ], [ stride ], offset, 'row-major' ); | ||
| } |
There was a problem hiding this comment.
The vector helper function needs JSDoc documentation to match the pattern in snanmean/test/test.js:
| function vector( buffer, length, stride, offset ) { | |
| return new ndarray( 'float32', buffer, [ length ], [ stride ], offset, 'row-major' ); | |
| } | |
| /** | |
| * Returns a one-dimensional ndarray. | |
| * | |
| * @private | |
| * @param {Collection} buffer - underlying data buffer | |
| * @param {NonNegativeInteger} length - number of indexed elements | |
| * @param {integer} stride - stride length | |
| * @param {NonNegativeInteger} offset - index offset | |
| * @returns {ndarray} one-dimensional ndarray | |
| */ | |
| function vector( buffer, length, stride, offset ) { | |
| return new ndarray( 'float32', buffer, [ length ], [ stride ], offset, 'row-major' ); | |
| } |
|
|
||
| return benchmark; | ||
|
|
||
| function benchmark( b ) { |
There was a problem hiding this comment.
The nested benchmark function needs JSDoc documentation to match the pattern in snanmean/benchmark/benchmark.js:
| function benchmark( b ) { | |
| /** | |
| * Benchmark function. | |
| * | |
| * @private | |
| * @param {Benchmark} b - benchmark instance | |
| */ | |
| function benchmark( b ) { |
|
|
||
| // MAIN // | ||
|
|
||
| function main() { |
There was a problem hiding this comment.
The main function needs JSDoc documentation to match the pattern in snanmean/benchmark/benchmark.js:
| function main() { | |
| /** | |
| * Main execution sequence. | |
| * | |
| * @private | |
| */ | |
| function main() { |
---
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: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- 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: na
- task: lint_license_headers
status: passed
---
---
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: na
- task: lint_repl_help
status: na
- 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
---
---
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: passed
- 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
---
---
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: 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
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves #{{TODO: add issue number}}.
Description
This pull request:
Related Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
@stdlib-js/reviewers