Skip to content

Commit 1722b44

Browse files
committed
Auto-generated commit
1 parent e51f08c commit 1722b44

11 files changed

Lines changed: 1350 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`465a072`](https://github.com/stdlib-js/stdlib/commit/465a072ec949832752bd1aa2bdb7a3b165e90763) - add `ndarray/base/to-rotr90` [(#11747)](https://github.com/stdlib-js/stdlib/pull/11747)
1314
- [`bb94409`](https://github.com/stdlib-js/stdlib/commit/bb944095335edac473c0c655d7300228ed856ca5) - add `rot90` to namespace
1415
- [`902e522`](https://github.com/stdlib-js/stdlib/commit/902e522762ec678bc548d6a503d5a94046e708f1) - add `ndarray/rot90` [(#11705)](https://github.com/stdlib-js/stdlib/pull/11705)
1516
- [`7c878a8`](https://github.com/stdlib-js/stdlib/commit/7c878a8c3103503f9a2f7782861e3b9ccfeb33e5) - add `rot180` to namespace
@@ -879,6 +880,7 @@ A total of 49 issues were closed in this release:
879880

880881
<details>
881882

883+
- [`465a072`](https://github.com/stdlib-js/stdlib/commit/465a072ec949832752bd1aa2bdb7a3b165e90763) - **feat:** add `ndarray/base/to-rotr90` [(#11747)](https://github.com/stdlib-js/stdlib/pull/11747) _(by Muhammad Haris, Athan Reines)_
882884
- [`1bb47ae`](https://github.com/stdlib-js/stdlib/commit/1bb47aee4385a96718afb38792d96ec5ec09e7da) - **docs:** fix comment _(by Athan Reines)_
883885
- [`8c95fbf`](https://github.com/stdlib-js/stdlib/commit/8c95fbf9f000fba1e6a302792a33ac7394262a1c) - **docs:** fix comment _(by Athan Reines)_
884886
- [`d1f33dc`](https://github.com/stdlib-js/stdlib/commit/d1f33dcee27be7cc4bfb9ddd977497ff21ee8be6) - **docs:** update ToC _(by Athan Reines)_

base/to-rotr90/README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# toRotr90
22+
23+
> Return a new ndarray where a matrix (or a stack of matrices) is rotated 90 degrees clockwise.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var toRotr90 = require( '@stdlib/ndarray/base/to-rotr90' );
41+
```
42+
43+
#### toRotr90( x, k )
44+
45+
Returns a new ndarray where a matrix (or a stack of matrices) is rotated 90 degrees clockwise.
46+
47+
```javascript
48+
var array = require( '@stdlib/ndarray/array' );
49+
50+
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
51+
// returns <ndarray>[ [ 1, 2 ], [ 3, 4 ] ]
52+
53+
var y = toRotr90( x, 1 );
54+
// returns <ndarray>[ [ 3, 1 ], [ 4, 2 ] ]
55+
```
56+
57+
The function accepts the following arguments:
58+
59+
- **x**: input ndarray.
60+
- **k**: number of times to rotate by 90 degrees. Positive values rotate clockwise. Negative values rotate counterclockwise.
61+
62+
</section>
63+
64+
<!-- /.usage -->
65+
66+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
67+
68+
<section class="notes">
69+
70+
## Notes
71+
72+
- If `k > 0`, the function rotates the matrix clockwise.
73+
- If `k < 0`, the function rotates the matrix counterclockwise.
74+
- If provided an ndarray with fewer than two dimensions, the function does not perform a rotation and simply returns a copy of the input ndarray.
75+
76+
</section>
77+
78+
<!-- /.notes -->
79+
80+
<!-- Package usage examples. -->
81+
82+
<section class="examples">
83+
84+
## Examples
85+
86+
<!-- eslint no-undef: "error" -->
87+
88+
```javascript
89+
var array = require( '@stdlib/ndarray/array' );
90+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
91+
var toRotr90 = require( '@stdlib/ndarray/base/to-rotr90' );
92+
93+
// Create a 2x3 matrix:
94+
var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
95+
96+
// Rotate 90 degrees clockwise:
97+
var y = toRotr90( x, 1 );
98+
var arr = ndarray2array( y );
99+
// returns [ [ 4, 1 ], [ 5, 2 ], [ 6, 3 ] ]
100+
101+
// Rotate 180 degrees:
102+
y = toRotr90( x, 2 );
103+
arr = ndarray2array( y );
104+
// returns [ [ 6, 5, 4 ], [ 3, 2, 1 ] ]
105+
106+
// Rotate 270 degrees clockwise (equivalent to 90 degrees counterclockwise):
107+
y = toRotr90( x, 3 );
108+
arr = ndarray2array( y );
109+
// returns [ [ 3, 6 ], [ 2, 5 ], [ 1, 4 ] ]
110+
111+
// Rotate 360 degrees (equivalent to no rotation):
112+
y = toRotr90( x, 4 );
113+
arr = ndarray2array( y );
114+
// returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
115+
116+
// Rotate 90 degrees counterclockwise (equivalent to 270 degrees clockwise):
117+
y = toRotr90( x, -1 );
118+
arr = ndarray2array( y );
119+
// returns [ [ 3, 6 ], [ 2, 5 ], [ 1, 4 ] ]
120+
```
121+
122+
</section>
123+
124+
<!-- /.examples -->
125+
126+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
127+
128+
<section class="references">
129+
130+
</section>
131+
132+
<!-- /.references -->
133+
134+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
135+
136+
<section class="related">
137+
138+
</section>
139+
140+
<!-- /.related -->
141+
142+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
143+
144+
<section class="links">
145+
146+
<!-- <related-links> -->
147+
148+
<!-- </related-links> -->
149+
150+
</section>
151+
152+
<!-- /.links -->

0 commit comments

Comments
 (0)