-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add blas/ext/base/drssors
#9086
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 blas/ext/base/drssors
#9086
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: passed
- task: lint_c_examples
status: passed
- task: lint_c_benchmarks
status: passed
- 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
---
…hmark name
---
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: na
- 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
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
lib/node_modules/@stdlib/blas/ext/base/drssors/test/test.drssors.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/drssors/test/test.drssors.native.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/drssors/test/test.ndarray.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/drssors/test/test.ndarray.native.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Nakul Krishnakumar <[email protected]>
|
|
||
| # drssors | ||
|
|
||
| > Calculate the [residual sum of squares][wikipedia-residual-sum-of-squares] of two double-precision floating-point strided arrays, ignoring `NaN` values and using an ordinary recursive summation. |
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.
@nakul-krishnakumar If this package is supposed to ignore NaN values, it is misnamed. It should be dnanrssors. For drssors, we shouldn't have any special NaN handling.
Accordingly, in order to avoid unnecessary work, I suggest simply renaming this package (and all aliases) from drssors to dnanrssors.
| y = new Float64Array( [ -1.0e-15, -1.0e-15, -1.0e-15, -1.0e-15 ] ); | ||
|
|
||
| z = drssors( x.length, x, 1, y, 1 ); | ||
| t.strictEqual( z, 1.6e-29, 'returns expected value' ); |
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.
These expected values were computed how? Did you test against a reference implementation? Calculate by hand? Something else?
In general, we prefer avoiding magic numbers in test cases. For example, if computed by hand, one might add a comment like
// Test against textbook formula: ( (1+1) + (1+1) + (1+1) + (1+1) )^2 * (10^-15)^2
Otherwise, future readers are liable to simply assume that you either made the numbers up or you simply performed a circular test (i.e., the "expected" value is computed the implementation you are wanting to test). TL;DR: test cases should be generated independently of the implementation, and, where possible, we should document how they were computed, if it is not immediately obvious or the implementation cannot be inlined.
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.
@kgryte These were actually calculated using a reference implementation, from next time I will make sure to properly document the computation. Thank you for the suggestion :)
| var y; | ||
| var z; | ||
|
|
||
| x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 0.0, 3.0 ] ); |
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.
Your implementation is designed to ignore NaN values, and yet your tests do not test for this behavior at all. They all contain only non-NaN values. You should study stats/strided for how we test against nan* and non-nan variants.
kgryte
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.
Left initial comments.
lib/node_modules/@stdlib/blas/ext/base/drssors/benchmark/benchmark.native.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/drssors/benchmark/benchmark.ndarray.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/drssors/benchmark/benchmark.ndarray.native.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Nakul Krishnakumar <[email protected]>
|
/stdlib update-copyright-years |
@nakul-krishnakumar, the slash command failed to complete. Please check the workflow logs for details. |
|
/stdlib merge |
|
@nakul-krishnakumar Lint failures. |
|
This PR is WIP. |
Resolves None.
Description
This pull request:
blas/ext/base/drssors.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
None.
@stdlib-js/reviewers