-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add stats/base/ndarray/svariancech
#9683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
---
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
---
---
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: 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
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
Signed-off-by: Divyanshu <[email protected]>
| * var v = variancech( [ x, correction ] ); | ||
| * // returns 6.25 | ||
| */ | ||
| function variancech( arrays ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name should be svariancech (not variancech) to match the package name and follow the stdlib naming convention for single-precision functions.
| * | ||
| * var correction = scalar2ndarray( 1.0, opts ); | ||
| * | ||
| * var v = variancech( [ x, correction ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc example also uses variancech but should use svariancech to match the function name.
| * var v = variancech( [ x, correction ] ); | |
| * var v = svariancech( [ x, correction ] ); |
|
|
||
| // EXPORTS // | ||
|
|
||
| module.exports = variancech; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The export should also be updated to match the renamed function.
| module.exports = variancech; | |
| module.exports = svariancech; |
|
|
||
| /// <reference types="@stdlib/types"/> | ||
|
|
||
| import { typedndarray } from '@stdlib/types/ndarray'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For single-precision packages, we should also import float32ndarray to use in the function signature. Looking at sstdevch, it imports both types.
| import { typedndarray } from '@stdlib/types/ndarray'; | |
| import { float32ndarray, typedndarray } from '@stdlib/types/ndarray'; |
| * var v = svariancech( [ x, correction ] ); | ||
| * // returns ~4.3333 | ||
| */ | ||
| declare function svariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ T, T ] ): number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first parameter should be float32ndarray (not generic T) to ensure type safety for this single-precision function. Looking at sstdevch, it uses [ float32ndarray, T ].
| declare function svariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ T, T ] ): number; | |
| declare function svariancech<T extends typedndarray<number> = typedndarray<number>>( arrays: [ float32ndarray, 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/svariancechRelated 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