feat: add blas/ext/base/ndarray/dapxsum#9287
feat: add blas/ext/base/ndarray/dapxsum#9287piyxsh31 wants to merge 8 commits intostdlib-js:developfrom
blas/ext/base/ndarray/dapxsum#9287Conversation
---
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. |
Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
|
|
||
| # dapxsum | ||
|
|
||
| > Add a scalar constant to each one-dimensional double-precision floating-point ndarray element and compute the sum. |
There was a problem hiding this comment.
| > Add a scalar constant to each one-dimensional double-precision floating-point ndarray element and compute the sum. | |
| > Add a scalar constant to each element of a one-dimensional double-precision floating-point ndarray and compute the sum. |
Let's go ahead and make this change to the description here and elsewhere in this PR. I know that you are basing it off of blas/ext/base/dapxsum, but I think the suggested phrasing is a touch better.
| /** | ||
| * Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum. | ||
| * | ||
| * @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. |
There was a problem hiding this comment.
| * @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. | |
| * @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant |
| * Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum. | ||
| * | ||
| * @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. | ||
| * @returns computed sum |
There was a problem hiding this comment.
| * @returns computed sum | |
| * @returns sum |
| /** | ||
| * Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum. | ||
| * | ||
| * @param {ArrayLikeObject<Object>} arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. |
There was a problem hiding this comment.
| * @param {ArrayLikeObject<Object>} arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. | |
| * @param {ArrayLikeObject<Object>} arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant |
| * Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum. | ||
| * | ||
| * @param {ArrayLikeObject<Object>} arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray containing a scalar constant. | ||
| * @returns {number} computed sum |
There was a problem hiding this comment.
| * @returns {number} computed sum | |
| * @returns {number} sum |
| { | ||
| "name": "@stdlib/blas/ext/base/ndarray/dapxsum", | ||
| "version": "0.0.0", | ||
| "description": "Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum.", |
There was a problem hiding this comment.
| "description": "Adds a scalar constant to each one-dimensional double-precision floating-point ndarray element and computes the sum.", | |
| "description": "Add a scalar constant to each element of a one-dimensional double-precision floating-point ndarray and compute the sum.", |
| t.end(); | ||
| }); | ||
|
|
||
| tape( 'the function adds a scalar constant to each element and computes the sum', function test( t ) { |
There was a problem hiding this comment.
The tests here are a little too spartan. See other similar base/ndarray packages. You should include tests for non-unit strides, a non-zero offset, negative strides, and what happens when provided an empty ndarray.
| v = dapxsum( [ x, alpha ] ); | ||
|
|
||
| t.strictEqual( v, 16.0, 'returns expected sum' ); | ||
| t.deepEqual( getData( x ), new Float64Array( [ 1.0, -2.0, 2.0 ] ), 'does not mutate input ndarray' ); |
There was a problem hiding this comment.
| t.deepEqual( getData( x ), new Float64Array( [ 1.0, -2.0, 2.0 ] ), 'does not mutate input ndarray' ); | |
| t.deepEqual( getData( x ), new Float64Array( [ 1.0, -2.0, 2.0 ] ), 'returns expected value' ); |
|
|
||
| v = dapxsum( [ x, alpha ] ); | ||
|
|
||
| t.strictEqual( v, 16.0, 'returns expected sum' ); |
There was a problem hiding this comment.
| t.strictEqual( v, 16.0, 'returns expected sum' ); | |
| t.strictEqual( v, 16.0, 'returns expected value' ); |
kgryte
left a comment
There was a problem hiding this comment.
Overall, this is looking good. Needs some minor clean-up and additional tests.
---
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: 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: passed
- task: lint_license_headers
status: passed
---
|
@kgryte Whenever you have time, could you please take another look? Thanks! |
lib/node_modules/@stdlib/blas/ext/base/ndarray/dapxsum/README.md
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/ndarray/dapxsum/docs/repl.txt
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/ndarray/dapxsum/docs/repl.txt
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/ndarray/dapxsum/docs/types/index.d.ts
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/blas/ext/base/ndarray/dapxsum/lib/main.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
…pl.txt Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
…pl.txt Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
…pes/index.d.ts Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
…n.js Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: piyxsh31 <agrawalpiyush415@gmail.com>
|
@Planeshifter Whenever you have time, could you please take another look? Thanks! |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Description
This pull request:
blas/ext/base/ndarray/dapxsumRelated Issues
No.
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