Skip to content

Commit ca982a8

Browse files
committed
Auto-generated commit
1 parent 67efeea commit ca982a8

File tree

12 files changed

+1490
-4
lines changed

12 files changed

+1490
-4
lines changed

CHANGELOG.md

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

1111
### Features
1212

13+
- [`cda31f5`](https://github.com/stdlib-js/stdlib/commit/cda31f53eb384a004a50c4249cb6e7d0795285d5) - add `ndarray/base/rotr90` [(#11030)](https://github.com/stdlib-js/stdlib/pull/11030)
1314
- [`142964b`](https://github.com/stdlib-js/stdlib/commit/142964bca2c6774129f0807bcb9786ebc373646d) - refactor declarations to satisfy TS's structural typing
1415
- [`aac0a2b`](https://github.com/stdlib-js/stdlib/commit/aac0a2be45cc8c0d70542b91d4ac3a958ea4881d) - add `ndarray2string` to namespace
1516
- [`47e4985`](https://github.com/stdlib-js/stdlib/commit/47e4985d18efb25b0fc00c6818fccdf547c9113e) - add `ndarray/to-string` [(#10899)](https://github.com/stdlib-js/stdlib/pull/10899)
@@ -818,9 +819,9 @@
818819

819820
### Closed Issues
820821

821-
A total of 46 issues were closed in this release:
822+
A total of 47 issues were closed in this release:
822823

823-
[#5526](https://github.com/stdlib-js/stdlib/issues/5526), [#5788](https://github.com/stdlib-js/stdlib/issues/5788), [#5960](https://github.com/stdlib-js/stdlib/issues/5960), [#6053](https://github.com/stdlib-js/stdlib/issues/6053), [#6236](https://github.com/stdlib-js/stdlib/issues/6236), [#6456](https://github.com/stdlib-js/stdlib/issues/6456), [#6457](https://github.com/stdlib-js/stdlib/issues/6457), [#6473](https://github.com/stdlib-js/stdlib/issues/6473), [#6521](https://github.com/stdlib-js/stdlib/issues/6521), [#6574](https://github.com/stdlib-js/stdlib/issues/6574), [#6589](https://github.com/stdlib-js/stdlib/issues/6589), [#6604](https://github.com/stdlib-js/stdlib/issues/6604), [#6663](https://github.com/stdlib-js/stdlib/issues/6663), [#6776](https://github.com/stdlib-js/stdlib/issues/6776), [#6933](https://github.com/stdlib-js/stdlib/issues/6933), [#7114](https://github.com/stdlib-js/stdlib/issues/7114), [#7135](https://github.com/stdlib-js/stdlib/issues/7135), [#7215](https://github.com/stdlib-js/stdlib/issues/7215), [#7296](https://github.com/stdlib-js/stdlib/issues/7296), [#7395](https://github.com/stdlib-js/stdlib/issues/7395), [#7554](https://github.com/stdlib-js/stdlib/issues/7554), [#7626](https://github.com/stdlib-js/stdlib/issues/7626), [#7767](https://github.com/stdlib-js/stdlib/issues/7767), [#7973](https://github.com/stdlib-js/stdlib/issues/7973), [#8129](https://github.com/stdlib-js/stdlib/issues/8129), [#8156](https://github.com/stdlib-js/stdlib/issues/8156), [#8159](https://github.com/stdlib-js/stdlib/issues/8159), [#8189](https://github.com/stdlib-js/stdlib/issues/8189), [#8196](https://github.com/stdlib-js/stdlib/issues/8196), [#8225](https://github.com/stdlib-js/stdlib/issues/8225), [#8308](https://github.com/stdlib-js/stdlib/issues/8308), [#8484](https://github.com/stdlib-js/stdlib/issues/8484), [#8508](https://github.com/stdlib-js/stdlib/issues/8508), [#8515](https://github.com/stdlib-js/stdlib/issues/8515), [#8563](https://github.com/stdlib-js/stdlib/issues/8563), [#8608](https://github.com/stdlib-js/stdlib/issues/8608), [#8796](https://github.com/stdlib-js/stdlib/issues/8796), [#9109](https://github.com/stdlib-js/stdlib/issues/9109), [#9462](https://github.com/stdlib-js/stdlib/issues/9462), [#9569](https://github.com/stdlib-js/stdlib/issues/9569), [#9570](https://github.com/stdlib-js/stdlib/issues/9570), [#9792](https://github.com/stdlib-js/stdlib/issues/9792), [#9843](https://github.com/stdlib-js/stdlib/issues/9843), [#10378](https://github.com/stdlib-js/stdlib/issues/10378), [#11152](https://github.com/stdlib-js/stdlib/issues/11152), [#11334](https://github.com/stdlib-js/stdlib/issues/11334)
824+
[#5526](https://github.com/stdlib-js/stdlib/issues/5526), [#5788](https://github.com/stdlib-js/stdlib/issues/5788), [#5960](https://github.com/stdlib-js/stdlib/issues/5960), [#6053](https://github.com/stdlib-js/stdlib/issues/6053), [#6236](https://github.com/stdlib-js/stdlib/issues/6236), [#6456](https://github.com/stdlib-js/stdlib/issues/6456), [#6457](https://github.com/stdlib-js/stdlib/issues/6457), [#6473](https://github.com/stdlib-js/stdlib/issues/6473), [#6521](https://github.com/stdlib-js/stdlib/issues/6521), [#6574](https://github.com/stdlib-js/stdlib/issues/6574), [#6589](https://github.com/stdlib-js/stdlib/issues/6589), [#6604](https://github.com/stdlib-js/stdlib/issues/6604), [#6663](https://github.com/stdlib-js/stdlib/issues/6663), [#6776](https://github.com/stdlib-js/stdlib/issues/6776), [#6933](https://github.com/stdlib-js/stdlib/issues/6933), [#7114](https://github.com/stdlib-js/stdlib/issues/7114), [#7135](https://github.com/stdlib-js/stdlib/issues/7135), [#7215](https://github.com/stdlib-js/stdlib/issues/7215), [#7296](https://github.com/stdlib-js/stdlib/issues/7296), [#7395](https://github.com/stdlib-js/stdlib/issues/7395), [#7554](https://github.com/stdlib-js/stdlib/issues/7554), [#7626](https://github.com/stdlib-js/stdlib/issues/7626), [#7767](https://github.com/stdlib-js/stdlib/issues/7767), [#7973](https://github.com/stdlib-js/stdlib/issues/7973), [#8129](https://github.com/stdlib-js/stdlib/issues/8129), [#8156](https://github.com/stdlib-js/stdlib/issues/8156), [#8159](https://github.com/stdlib-js/stdlib/issues/8159), [#8189](https://github.com/stdlib-js/stdlib/issues/8189), [#8196](https://github.com/stdlib-js/stdlib/issues/8196), [#8225](https://github.com/stdlib-js/stdlib/issues/8225), [#8308](https://github.com/stdlib-js/stdlib/issues/8308), [#8484](https://github.com/stdlib-js/stdlib/issues/8484), [#8508](https://github.com/stdlib-js/stdlib/issues/8508), [#8515](https://github.com/stdlib-js/stdlib/issues/8515), [#8563](https://github.com/stdlib-js/stdlib/issues/8563), [#8608](https://github.com/stdlib-js/stdlib/issues/8608), [#8796](https://github.com/stdlib-js/stdlib/issues/8796), [#9109](https://github.com/stdlib-js/stdlib/issues/9109), [#9462](https://github.com/stdlib-js/stdlib/issues/9462), [#9569](https://github.com/stdlib-js/stdlib/issues/9569), [#9570](https://github.com/stdlib-js/stdlib/issues/9570), [#9792](https://github.com/stdlib-js/stdlib/issues/9792), [#9843](https://github.com/stdlib-js/stdlib/issues/9843), [#10378](https://github.com/stdlib-js/stdlib/issues/10378), [#11152](https://github.com/stdlib-js/stdlib/issues/11152), [#11334](https://github.com/stdlib-js/stdlib/issues/11334), [#11347](https://github.com/stdlib-js/stdlib/issues/11347)
824825

825826
</section>
826827

@@ -832,6 +833,8 @@ A total of 46 issues were closed in this release:
832833

833834
<details>
834835

836+
- [`d6065f1`](https://github.com/stdlib-js/stdlib/commit/d6065f1af58925d59d168fe786ccdb2ccf3a8df0) - **chore:** fix C lint errors [(#11348)](https://github.com/stdlib-js/stdlib/pull/11348) _(by Guneet Gill, Athan Reines)_
837+
- [`cda31f5`](https://github.com/stdlib-js/stdlib/commit/cda31f53eb384a004a50c4249cb6e7d0795285d5) - **feat:** add `ndarray/base/rotr90` [(#11030)](https://github.com/stdlib-js/stdlib/pull/11030) _(by Muhammad Haris, Athan Reines)_
835838
- [`3df3c24`](https://github.com/stdlib-js/stdlib/commit/3df3c244943b00841d3abd5ac75c2a42e848c492) - **style:** remove empty line _(by Athan Reines)_
836839
- [`801907f`](https://github.com/stdlib-js/stdlib/commit/801907f3df34913321d0f977117114fbb1bcb618) - **style:** remove empty line _(by Athan Reines)_
837840
- [`8bac83f`](https://github.com/stdlib-js/stdlib/commit/8bac83f2664cdc3a7023421d7ab583c9d8b3b1eb) - **docs:** update examples _(by Athan Reines)_
@@ -2417,7 +2420,7 @@ A total of 46 issues were closed in this release:
24172420

24182421
### Contributors
24192422

2420-
A total of 41 people contributed to this release. Thank you to the following contributors:
2423+
A total of 42 people contributed to this release. Thank you to the following contributors:
24212424

24222425
- Aryan kumar
24232426
- Athan Reines
@@ -2431,6 +2434,7 @@ A total of 41 people contributed to this release. Thank you to the following con
24312434
- DivitJain26
24322435
- Gautam Kaushik
24332436
- Geo Daoyu
2437+
- Guneet Gill
24342438
- Gururaj Gurram
24352439
- Harshit Verma
24362440
- Karan Vasudevamurthy

base/rotr90/README.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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+
# rotr90
22+
23+
> Rotate a matrix (or a stack of matrices) 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 rotr90 = require( '@stdlib/ndarray/base/rotr90' );
41+
```
42+
43+
#### rotr90( x, k, writable )
44+
45+
Rotates a matrix (or a stack of matrices) 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 = rotr90( x, 1, false );
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+
- **writable**: boolean indicating whether a returned ndarray should be writable.
62+
63+
</section>
64+
65+
<!-- /.usage -->
66+
67+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
68+
69+
<section class="notes">
70+
71+
## Notes
72+
73+
- The `writable` parameter **only** applies to ndarray constructors supporting **read-only** instances.
74+
- If `k > 0`, the function rotates the matrix clockwise.
75+
- If `k < 0`, the function rotates the matrix counterclockwise.
76+
- The returned ndarray is a **view** of the input ndarray. Accordingly, writing to the original ndarray will **mutate** the returned ndarray and vice versa.
77+
- If provided an ndarray with fewer than two dimensions, the function does not perform rotation and simply returns a new view of the input ndarray.
78+
79+
</section>
80+
81+
<!-- /.notes -->
82+
83+
<!-- Package usage examples. -->
84+
85+
<section class="examples">
86+
87+
## Examples
88+
89+
<!-- eslint no-undef: "error" -->
90+
91+
```javascript
92+
var array = require( '@stdlib/ndarray/array' );
93+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
94+
var rotr90 = require( '@stdlib/ndarray/base/rotr90' );
95+
96+
// Create a 2x3 matrix:
97+
var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
98+
99+
// Rotate 90 degrees clockwise:
100+
var y = rotr90( x, 1, false );
101+
var arr = ndarray2array( y );
102+
// returns [ [ 4, 1 ], [ 5, 2 ], [ 6, 3 ] ]
103+
104+
// Rotate 180 degrees:
105+
y = rotr90( x, 2, false );
106+
arr = ndarray2array( y );
107+
// returns [ [ 6, 5, 4 ], [ 3, 2, 1 ] ]
108+
109+
// Rotate 270 degrees clockwise (equivalent to 90 degrees counterclockwise):
110+
y = rotr90( x, 3, false );
111+
arr = ndarray2array( y );
112+
// returns [ [ 3, 6 ], [ 2, 5 ], [ 1, 4 ] ]
113+
114+
// Rotate 360 degrees (equivalent to no rotation):
115+
y = rotr90( x, 4, false );
116+
arr = ndarray2array( y );
117+
// returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
118+
119+
// Rotate 90 degrees counterclockwise (equivalent to 270 degrees clockwise):
120+
y = rotr90( x, -1, false );
121+
arr = ndarray2array( y );
122+
// returns [ [ 3, 6 ], [ 2, 5 ], [ 1, 4 ] ]
123+
```
124+
125+
</section>
126+
127+
<!-- /.examples -->
128+
129+
<!-- 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. -->
130+
131+
<section class="references">
132+
133+
</section>
134+
135+
<!-- /.references -->
136+
137+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
138+
139+
<section class="related">
140+
141+
</section>
142+
143+
<!-- /.related -->
144+
145+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
146+
147+
<section class="links">
148+
149+
<!-- <related-links> -->
150+
151+
<!-- </related-links> -->
152+
153+
</section>
154+
155+
<!-- /.links -->

0 commit comments

Comments
 (0)