-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add stats/base/ndarray/sstdevtk
#9917
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?
feat: add stats/base/ndarray/sstdevtk
#9917
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
Planeshifter
left a comment
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.
Thanks for opening a PR!
| function createBenchmark(len) { | ||
| var correction; | ||
| var xbuf; | ||
| var x; | ||
|
|
||
| xbuf = uniform(len, -10.0, 10.0, options); | ||
| x = new ndarray(options.dtype, xbuf, [len], [1], 0, 'row-major'); | ||
| correction = scalar2ndarray(1.0, options); | ||
|
|
||
| return benchmark; | ||
|
|
||
| /** | ||
| * Benchmark function. | ||
| * | ||
| * @private | ||
| * @param {Benchmark} b - benchmark instance | ||
| */ | ||
| function benchmark(b) { | ||
| var v; | ||
| var i; | ||
|
|
||
| b.tic(); | ||
| for (i = 0; i < b.iterations; i++) { | ||
| v = sstdevtk([x, correction]); | ||
| if (isnanf(v)) { | ||
| b.fail('should not return NaN'); | ||
| } | ||
| } | ||
| b.toc(); | ||
| if (isnanf(v)) { | ||
| b.fail('should not return NaN'); | ||
| } | ||
| b.pass('benchmark finished'); | ||
| b.end(); | ||
| } |
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 benchmark file is missing spaces inside parentheses throughout — stdlib style requires spaces after ( and before ) in function calls and declarations (e.g., createBenchmark( len ) not createBenchmark(len)). Compare with a package like @stdlib/stats/base/ndarray/sstdev/benchmark/benchmark.js which follows the correct spacing.
| for (i = min; i <= max; i++) { | ||
| len = pow(10, i); | ||
| f = createBenchmark(len); | ||
| bench(format('%s:len=%d', pkg, len), f); |
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.
Same spacing issue in main() — the for loop and function calls here also need spaces inside parentheses.
| for (i = min; i <= max; i++) { | |
| len = pow(10, i); | |
| f = createBenchmark(len); | |
| bench(format('%s:len=%d', pkg, len), f); | |
| for ( i = min; i <= max; i++ ) { | |
| len = pow( 10, i ); | |
| f = createBenchmark( len ); | |
| bench( format( '%s:len=%d', pkg, len ), f ); |
---
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
---
ede1d64 to
90544af
Compare
|
Hey, @Planeshifter thanks for catching that! Fixed the spacing throughout the benchmark file. Should be all good now . |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Description
This pull request:
Related 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