feat: add ndarray/base/rot90#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. |
| * // returns <ndarray>[ [ 2, 4 ], [ 1, 3 ] ] | ||
| * | ||
| */ | ||
| function rot90( x, k, writable ) { |
There was a problem hiding this comment.
Why did you choose not to support providing a list of dimensions, as done in NumPy?
There was a problem hiding this comment.
It looks like you chose to follow Julia here, but I don't think that was the correct choice within the wider context of packages we should add. My recommendation:
- Rename this utility to
rotlr90to reflect that we are only rotating the last two dimensions. - Add a new package
rot90which allows specifying the two dimensions to rotate.
In principle, the former could simply be a wrapper around the latter.
| } | ||
| st = getStrides( x, true ); | ||
| offset = getOffset( x ); | ||
| nk = ( ( k % 4 ) + 4 ) % 4; |
There was a problem hiding this comment.
Why are you doing two modulo operations?
There was a problem hiding this comment.
What this is intended to accommodate is a negative k after the first modulo operation. Prefer an explicit conditional. Otherwise, this line is entirely opaque to future readers.
| // MAIN // | ||
|
|
||
| /** | ||
| * Rotate a matrix (or a stack of matrices) by 90 degrees. |
There was a problem hiding this comment.
| * Rotate a matrix (or a stack of matrices) by 90 degrees. | |
| * Rotates a matrix (or a stack of matrices) by 90 degrees. |
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