Skip to content

Commit 9c3cf4c

Browse files
committed
Auto-generated commit
1 parent b5879d9 commit 9c3cf4c

11 files changed

Lines changed: 1296 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-05-04)
7+
## Unreleased (2026-05-05)
88

99
<section class="features">
1010

1111
### Features
1212

13+
- [`03405cc`](https://github.com/stdlib-js/stdlib/commit/03405cc777f8b9ac92e9e3629bc58161b7f388ac) - add `ndarray/base/to-reversed-dimensions` [(#11955)](https://github.com/stdlib-js/stdlib/pull/11955)
1314
- [`c625170`](https://github.com/stdlib-js/stdlib/commit/c6251708ba16c75c5e7d98d245dc86d7738ebfc1) - add `first`, `diagonal`, `reverseDimensions`, and `toUnflattened` to namespace
1415
- [`f1cdb3d`](https://github.com/stdlib-js/stdlib/commit/f1cdb3dc2daa032c75f77b1960375452913a2d3f) - add `fillDiagonal` to namespace
1516
- [`0710070`](https://github.com/stdlib-js/stdlib/commit/07100701aa7412f1d9eba15ae62511f5a74616ea) - add `ndarray/base/fill-diagonal` [(#11913)](https://github.com/stdlib-js/stdlib/pull/11913)
@@ -919,6 +920,7 @@ A total of 49 issues were closed in this release:
919920

920921
<details>
921922

923+
- [`03405cc`](https://github.com/stdlib-js/stdlib/commit/03405cc777f8b9ac92e9e3629bc58161b7f388ac) - **feat:** add `ndarray/base/to-reversed-dimensions` [(#11955)](https://github.com/stdlib-js/stdlib/pull/11955) _(by Muhammad Haris, Athan Reines)_
922924
- [`8516750`](https://github.com/stdlib-js/stdlib/commit/851675024a46ddac355e48493759d1e793a1de8a) - **fix:** add missing suffix wrappers [(#11904)](https://github.com/stdlib-js/stdlib/pull/11904) _(by Philipp Burckhardt)_
923925
- [`86e9aee`](https://github.com/stdlib-js/stdlib/commit/86e9aee4ae52aab8c7b7a1bbf2293da606e7c439) - **docs:** restore section template comments in `ndarray/base/diagonal` and `ndarray/last` [(#11903)](https://github.com/stdlib-js/stdlib/pull/11903) _(by Philipp Burckhardt)_
924926
- [`738b2c7`](https://github.com/stdlib-js/stdlib/commit/738b2c717eb26b3e374351f754d578f2035aaf20) - **docs:** update namespace table of contents [(#11916)](https://github.com/stdlib-js/stdlib/pull/11916) _(by stdlib-bot)_
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
# toReversedDimensions
22+
23+
> Return a new ndarray where the order of elements of an input ndarray along specified dimensions is reversed.
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 toReversedDimensions = require( '@stdlib/ndarray/base/to-reversed-dimensions' );
41+
```
42+
43+
#### toReversedDimensions( x, dims )
44+
45+
Returns a new ndarray where the order of elements of an input ndarray along specified dimensions is reversed.
46+
47+
```javascript
48+
var array = require( '@stdlib/ndarray/array' );
49+
50+
var x = array( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] );
51+
// returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
52+
53+
var y = toReversedDimensions( x, [ 0, 1 ] );
54+
// returns <ndarray>[ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
55+
```
56+
57+
The function accepts the following arguments:
58+
59+
- **x**: input ndarray.
60+
- **dims**: dimension indices along which to reverse elements. If provided an integer less than zero, the dimension index is resolved relative to the last dimension, with the last dimension corresponding to the value `-1`.
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+
</section>
71+
72+
<!-- /.notes -->
73+
74+
<!-- Package usage examples. -->
75+
76+
<section class="examples">
77+
78+
## Examples
79+
80+
<!-- eslint no-undef: "error" -->
81+
82+
```javascript
83+
var array = require( '@stdlib/ndarray/array' );
84+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
85+
var toReversedDimensions = require( '@stdlib/ndarray/base/to-reversed-dimensions' );
86+
87+
// Create a 3x2 matrix:
88+
var x = array( [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] );
89+
90+
// Reverse the order of the first dimension:
91+
var y = toReversedDimensions( x, [ 0 ] );
92+
var arr = ndarray2array( y );
93+
// returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
94+
95+
// Reverse the order of the second dimension:
96+
y = toReversedDimensions( x, [ 1 ] );
97+
arr = ndarray2array( y );
98+
// returns [ [ 2, 1 ], [ 4, 3 ], [ 6, 5 ] ]
99+
100+
// Reverse the order of all dimensions:
101+
y = toReversedDimensions( x, [ 0, 1 ] );
102+
arr = ndarray2array( y );
103+
// returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
104+
105+
// Supports negative dimension indices:
106+
y = toReversedDimensions( x, [ -2, -1 ] );
107+
arr = ndarray2array( y );
108+
// returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
109+
```
110+
111+
</section>
112+
113+
<!-- /.examples -->
114+
115+
<!-- 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. -->
116+
117+
<section class="references">
118+
119+
</section>
120+
121+
<!-- /.references -->
122+
123+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
124+
125+
<section class="related">
126+
127+
</section>
128+
129+
<!-- /.related -->
130+
131+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
132+
133+
<section class="links">
134+
135+
<!-- <related-links> -->
136+
137+
<!-- </related-links> -->
138+
139+
</section>
140+
141+
<!-- /.links -->

0 commit comments

Comments
 (0)