feat: add ndarray/base/rotr90#11030
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
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
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: passed
- 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
---
ndarray/base/rot90ndarray/base/rotr90
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
lib/node_modules/@stdlib/ndarray/base/rotr90/docs/types/index.d.ts
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/ndarray/base/rotr90/docs/types/index.d.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
| t.strictEqual( arr, x, 'returns expected value' ); | ||
|
|
||
| x = new base( 'float64', new Float64Array( [ 5.0 ] ), [], [ 0 ], 0, 'row-major' ); | ||
| arr = rotr90( x, 1, false ); | ||
| t.strictEqual( arr, x, 'returns expected value' ); |
There was a problem hiding this comment.
@headlessNode This doesn't actually test anything other than the the input array is returned. You need to actually test against (1) the underlying data buffer, (2) the shape, (3) the strides, (4) the order.
There was a problem hiding this comment.
As commented in the implementation, I am not sure we should be returning the input ndarray here, but instead should be returning a view regardless.
| t.strictEqual( arr, x, 'returns expected value' ); | ||
|
|
||
| x = new base( 'float64', new Float64Array( [ 1.0, 2.0, 3.0 ] ), [ 3 ], [ 1 ], 0, 'row-major' ); | ||
| arr = rotr90( x, 1, false ); | ||
| t.strictEqual( arr, x, 'returns expected value' ); |
| sh = getShape( x, true ); | ||
| d = sh.length; | ||
| if ( d < 2 ) { | ||
| return x; |
There was a problem hiding this comment.
@headlessNode Hmmm...what do we do elsewhere in a similar situation? Should we always be returning a view? Seems a bit odd that, here, we return the input ndarray, but when k%4 == 0, we always return a view.
I feel like we've had to do something like this before where we always return a new view regardless, especially as not doing so here effectively makes the writable parameter irrelevant under certain scenarios.
There was a problem hiding this comment.
Right. Just checked. In ndarray/base/fliplr, we always return a new view. We should likely follow suit here.
You'll always need to update related notes in the various docs saying that, for ndarrays having fewer than two dimensions, the function returns a new view of the input ndarray.
| t.end(); | ||
| }); | ||
|
|
||
| tape( 'the function supports the `writable` parameter', function test( t ) { |
There was a problem hiding this comment.
| tape( 'the function supports the `writable` parameter', function test( t ) { | |
| tape( 'the function supports a `writable` parameter', function test( t ) { |
kgryte
left a comment
There was a problem hiding this comment.
Left another round of comments. This PR is getting close.
|
For METR, |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves stdlib-js/metr-issue-tracker#203.
Description
This pull request:
ndarray/base/rot90Related Issues
This pull request has the following related issues:
ndarray/base/rot90metr-issue-tracker#203Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
Primarily written by Claude Code.
@stdlib-js/reviewers