feat: add stats/base/ndarray/dvariancech#9685
feat: add stats/base/ndarray/dvariancech#9685DivyanshuVortex wants to merge 4 commits intostdlib-js:developfrom
stats/base/ndarray/dvariancech#9685Conversation
---
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. |
| {{alias}}( arrays ) | ||
| Computes the variance of a one-dimensional single-precision floating-point | ||
| ndarray using a one-pass trial mean algorithm. |
There was a problem hiding this comment.
This says "single-precision" but it should say "double-precision" since this is a d-prefixed package working with float64 data.
| {{alias}}( arrays ) | |
| Computes the variance of a one-dimensional single-precision floating-point | |
| ndarray using a one-pass trial mean algorithm. | |
| {{alias}}( arrays ) | |
| Computes the variance of a one-dimensional double-precision floating-point | |
| ndarray using a one-pass trial mean algorithm. |
| // MODULES // | ||
|
|
||
| var tape = require( 'tape' ); | ||
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); |
There was a problem hiding this comment.
This should use isnan (double-precision) instead of isnanf (single-precision) since this package operates on float64 data. You can check similar packages like @stdlib/stats/base/ndarray/variancech or @stdlib/stats/base/ndarray/dstdev for reference.
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); | |
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); |
|
|
||
| var tape = require( 'tape' ); | ||
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); | ||
| var float64Array = require( '@stdlib/array/float64' ); |
There was a problem hiding this comment.
Constructor variables should use PascalCase per stdlib style guidelines.
| var float64Array = require( '@stdlib/array/float64' ); | |
| var Float64Array = require( '@stdlib/array/float64' ); |
---
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: 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
---
| function variancech( arrays ) { | ||
| var correction; | ||
| var x; | ||
|
|
||
| x = arrays[ 0 ]; | ||
| correction = ndarraylike2scalar( arrays[ 1 ] ); | ||
|
|
||
| return strided( numelDimension( x, 0 ), correction, getData( x ), getStride( x, 0 ), getOffset( x ) ); // eslint-disable-line max-len | ||
| } | ||
|
|
||
|
|
||
| // EXPORTS // | ||
|
|
||
| module.exports = variancech; |
There was a problem hiding this comment.
The function name should be dvariancech to match the package name.
|
|
||
| /// <reference types="@stdlib/types"/> | ||
|
|
||
| import { typedndarray } from '@stdlib/types/ndarray'; |
There was a problem hiding this comment.
Missing float64ndarray import. Comparing to the reference dstdev package, this should be:
| import { typedndarray } from '@stdlib/types/ndarray'; | |
| import { float64ndarray, typedndarray } from '@stdlib/types/ndarray'; |
| * var v = dvariancech( [ x, correction ] ); | ||
| * // returns ~4.3333 | ||
| */ | ||
| declare function dvariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ T, T ] ): number; |
There was a problem hiding this comment.
The first array element should be typed as float64ndarray since this is a double-precision function (the d prefix). Comparing to dstdev:
| declare function dvariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ T, T ] ): number; | |
| declare function dvariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ float64ndarray, T ] ): number; |
---
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: passed
- task: lint_license_headers
status: passed
---
Resolves : none.
Description
This pull request:
stats/base/ndarray/dvariancechRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers