diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61c8a38c..b760f53b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,93 @@
> Package changelog.
+
+
+## Unreleased (2024-09-07)
+
+
+
+### Packages
+
+
+
+#### [@stdlib/ndarray/base/reverse](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/reverse)
+
+
+
+
+
+##### Features
+
+- [`8bcb738`](https://github.com/stdlib-js/stdlib/commit/8bcb738f0fc355eae92b40541cc61550fda1fbef) - add `ndarray/base/to-reversed` [(#2861)](https://github.com/stdlib-js/stdlib/pull/2861)
+
+
+
+
+
+
+
+
+
+
+
+
+
+#### [@stdlib/ndarray/base/to-reversed](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/to-reversed)
+
+
+
+
+
+##### Features
+
+- [`8bcb738`](https://github.com/stdlib-js/stdlib/commit/8bcb738f0fc355eae92b40541cc61550fda1fbef) - add `ndarray/base/to-reversed` [(#2861)](https://github.com/stdlib-js/stdlib/pull/2861)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Contributors
+
+A total of 2 people contributed to this release. Thank you to the following contributors:
+
+- Athan Reines
+- Muhammad Haris
+
+
+
+
+
+
+
+### Commits
+
+
+
+- [`8bcb738`](https://github.com/stdlib-js/stdlib/commit/8bcb738f0fc355eae92b40541cc61550fda1fbef) - **feat:** add `ndarray/base/to-reversed` [(#2861)](https://github.com/stdlib-js/stdlib/pull/2861) _(by Muhammad Haris, Athan Reines)_
+
+
+
+
+
+
+
+
+
+
+
## 0.3.1 (2024-08-18)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 57d1184a..0d819580 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -26,6 +26,7 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
Frank Kovacs
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
Gunj Joshi
+HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
Harshita Kalani
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
@@ -96,3 +97,4 @@ nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
orimiles5 <97595296+orimiles5@users.noreply.github.com>
rainn <88160429+AmCodesLame@users.noreply.github.com>
rei2hu
+yaswanth <116426380+yaswanthkosuru@users.noreply.github.com>
diff --git a/README.md b/README.md
index e1f45433..313e687a 100644
--- a/README.md
+++ b/README.md
@@ -226,8 +226,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray.svg
[npm-url]: https://npmjs.org/package/@stdlib/ndarray
-[test-image]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml/badge.svg?branch=v0.3.1
-[test-url]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml?query=branch:v0.3.1
+[test-image]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml/badge.svg?branch=main
+[test-url]: https://github.com/stdlib-js/ndarray/actions/workflows/test.yml?query=branch:main
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray?branch=main
diff --git a/base/reverse/docs/types/index.d.ts b/base/reverse/docs/types/index.d.ts
index 84473380..55facc3d 100644
--- a/base/reverse/docs/types/index.d.ts
+++ b/base/reverse/docs/types/index.d.ts
@@ -20,7 +20,7 @@
///
-import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray';
+import { ndarray } from '@stdlib/types/ndarray';
/**
* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
@@ -57,439 +57,7 @@ import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndar
* arr = ndarray2array( y );
* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
*/
-declare function reverse( x: float64ndarray, writable: boolean ): float64ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float32' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'float32', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
-*/
-declare function reverse( x: float32ndarray, writable: boolean ): float32ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int32' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'int32', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: int32ndarray, writable: boolean ): int32ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int16' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'int16', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: int16ndarray, writable: boolean ): int16ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'int8' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'int8', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: int8ndarray, writable: boolean ): int8ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint32' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'uint32', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: uint32ndarray, writable: boolean ): uint32ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint16' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'uint16', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: uint16ndarray, writable: boolean ): uint16ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint8' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'uint8', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: uint8ndarray, writable: boolean ): uint8ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1, 2, 3, 4, 5, 6 ], 'uint8c' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'uint8c', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: uint8cndarray, writable: boolean ): uint8cndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ], 'complex128' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'complex128', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*/
-declare function reverse( x: complex128ndarray, writable: boolean ): complex128ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ], 'complex64' );
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'complex64', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*/
-declare function reverse( x: complex64ndarray, writable: boolean ): complex64ndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = [ 1, 2, 3, 4, 5, 6 ];
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: genericndarray, writable: boolean ): genericndarray;
-
-/**
-* Returns a view of an input ndarray in which the order of elements along each dimension is reversed.
-*
-* @param x - input array
-* @param writable - boolean indicating whether a returned array should be writable
-* @returns output array
-*
-* @example
-* var typedarray = require( '@stdlib/array/typed' );
-* var ndarray = require( '@stdlib/ndarray/ctor' );
-* var ndarray2array = require( '@stdlib/ndarray/to-array' );
-*
-* var buffer = [ 1, 2, 3, 4, 5, 6 ];
-* var shape = [ 3, 2 ];
-* var strides = [ 2, 1 ];
-* var offset = 0;
-*
-* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
-* // returns
-*
-* var sh = x.shape;
-* // returns [ 3, 2 ]
-*
-* var arr = ndarray2array( x );
-* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
-*
-* var y = reverse( x, false );
-* // returns
-*
-* sh = y.shape;
-* // returns [ 3, 2 ]
-*
-* arr = ndarray2array( y );
-* // returns [ [ 6, 5 ], [ 4, 3 ], [ 2, 1 ] ]
-*/
-declare function reverse( x: typedndarray, writable: boolean ): typedndarray;
+declare function reverse( x: T, writable: boolean ): T;
// EXPORTS //
diff --git a/base/reverse/docs/types/test.ts b/base/reverse/docs/types/test.ts
index 1d6bdb5e..9aa88d21 100644
--- a/base/reverse/docs/types/test.ts
+++ b/base/reverse/docs/types/test.ts
@@ -38,6 +38,7 @@ import reverse = require( './index' );
reverse( empty( 'uint16', sh, order ), false ); // $ExpectType uint16ndarray
reverse( empty( 'uint8', sh, order ), false ); // $ExpectType uint8ndarray
reverse( empty( 'uint8c', sh, order ), false ); // $ExpectType uint8cndarray
+ reverse( empty( 'generic', sh, order ), false ); // $ExpectType genericndarray
reverse( empty( 'float64', sh, order ), true ); // $ExpectType float64ndarray
reverse( empty( 'float32', sh, order ), true ); // $ExpectType float32ndarray
@@ -50,6 +51,7 @@ import reverse = require( './index' );
reverse( empty( 'uint16', sh, order ), true ); // $ExpectType uint16ndarray
reverse( empty( 'uint8', sh, order ), true ); // $ExpectType uint8ndarray
reverse( empty( 'uint8c', sh, order ), true ); // $ExpectType uint8cndarray
+ reverse( empty( 'generic', sh, order ), false ); // $ExpectType genericndarray
}
// The compiler throws an error if the function is provided a first argument which is not an ndarray...
diff --git a/base/to-reversed/README.md b/base/to-reversed/README.md
new file mode 100644
index 00000000..bac19136
--- /dev/null
+++ b/base/to-reversed/README.md
@@ -0,0 +1,171 @@
+
+
+# toReversed
+
+> Return a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var toReversed = require( '@stdlib/ndarray/base/to-reversed' );
+```
+
+#### toReversed( x )
+
+Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
+
+```javascript
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+
+var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+var shape = [ 3, 2 ];
+var strides = [ 2, 1 ];
+var offset = 0;
+
+var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
+// returns
+
+var sh = x.shape;
+// returns [ 3, 2 ]
+
+var arr = ndarray2array( x );
+// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
+
+var y = toReversed( x );
+// returns
+
+sh = y.shape;
+// returns [ 3, 2 ]
+
+arr = ndarray2array( y );
+// returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
+```
+
+The function accepts the following arguments:
+
+- **x**: input ndarray.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var zeroTo = require( '@stdlib/array/base/zero-to' );
+var toReversed = require( '@stdlib/ndarray/base/to-reversed' );
+
+// Create a linear ndarray buffer:
+var buf = zeroTo( 16 );
+
+// Create a one-dimensional ndarray:
+var x1 = array( buf, {
+ 'shape': [ 16 ]
+});
+
+// Reverse element order:
+var y1 = toReversed( x1, false );
+// returns
+
+var a1 = ndarray2array( y1 );
+// returns [ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ]
+
+// Create a two-dimensional ndarray:
+var x2 = array( buf, {
+ 'shape': [ 4, 4 ]
+});
+
+// Reverse element order:
+var y2 = toReversed( x2, false );
+// returns
+
+var a2 = ndarray2array( y2 );
+// returns [ [ 15, 14, 13, 12 ], [ 11, 10, 9, 8 ], [ 7, 6, 5, 4 ], [ 3, 2, 1, 0 ] ]
+
+// Create a three-dimensional ndarray:
+var x3 = array( buf, {
+ 'shape': [ 2, 4, 2 ]
+});
+
+// Reverse element order:
+var y3 = toReversed( x3, false );
+// returns
+
+var a3 = ndarray2array( y3 );
+// returns [ [ [ 15, 14 ], [ 13, 12 ], [ 11, 10 ], [ 9, 8 ] ], [ [ 7, 6 ], [ 5, 4 ], [ 3, 2 ], [ 1, 0 ] ] ]
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/base/to-reversed/benchmarks/benchmark.js b/base/to-reversed/benchmarks/benchmark.js
new file mode 100644
index 00000000..3d1158cd
--- /dev/null
+++ b/base/to-reversed/benchmarks/benchmark.js
@@ -0,0 +1,393 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2023 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable no-restricted-syntax */
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var baseEmpty = require( './../../../base/empty' );
+var empty = require( './../../../empty' );
+var pkg = require( './../package.json' ).name;
+var toReversed = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg+'::0d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [], 'row-major' ),
+ baseEmpty( 'float32', [], 'row-major' ),
+ baseEmpty( 'int32', [], 'row-major' ),
+ baseEmpty( 'complex128', [], 'row-major' ),
+ baseEmpty( 'generic', [], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::0d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [], { 'dtype': 'float64' } ),
+ empty( [], { 'dtype': 'float32' } ),
+ empty( [], { 'dtype': 'int32' } ),
+ empty( [], { 'dtype': 'complex128' } ),
+ empty( [], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::1d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [ 2 ], 'row-major' ),
+ baseEmpty( 'float32', [ 2 ], 'row-major' ),
+ baseEmpty( 'int32', [ 2 ], 'row-major' ),
+ baseEmpty( 'complex128', [ 2 ], 'row-major' ),
+ baseEmpty( 'generic', [ 2 ], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::1d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [ 2 ], { 'dtype': 'float64' } ),
+ empty( [ 2 ], { 'dtype': 'float32' } ),
+ empty( [ 2 ], { 'dtype': 'int32' } ),
+ empty( [ 2 ], { 'dtype': 'complex128' } ),
+ empty( [ 2 ], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::2d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [ 2, 2 ], 'row-major' ),
+ baseEmpty( 'float32', [ 2, 2 ], 'row-major' ),
+ baseEmpty( 'int32', [ 2, 2 ], 'row-major' ),
+ baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ),
+ baseEmpty( 'generic', [ 2, 2 ], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::2d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [ 2, 2 ], { 'dtype': 'float64' } ),
+ empty( [ 2, 2 ], { 'dtype': 'float32' } ),
+ empty( [ 2, 2 ], { 'dtype': 'int32' } ),
+ empty( [ 2, 2 ], { 'dtype': 'complex128' } ),
+ empty( [ 2, 2 ], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::3d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::3d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ),
+ empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ),
+ empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ),
+ empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ),
+ empty( [ 2, 2, 2 ], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::4d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::4d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
+ empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
+ empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
+ empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
+ empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::5d,base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ),
+ baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+'::5d,non-base', function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline */
+
+ values = [
+ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
+ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
+ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
+ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
+ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } )
+ ];
+
+ /* eslint-enable object-curly-newline */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = toReversed( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/base/to-reversed/docs/repl.txt b/base/to-reversed/docs/repl.txt
new file mode 100644
index 00000000..c45dc101
--- /dev/null
+++ b/base/to-reversed/docs/repl.txt
@@ -0,0 +1,31 @@
+
+{{alias}}( x )
+ Returns a new ndarray where the order of elements of an input ndarray is
+ reversed along each dimension.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] )
+
+ > x.shape
+ [ 2, 2 ]
+ > var y = {{alias}}( x )
+
+ > y.shape
+ [ 2, 2 ]
+ > {{alias:@stdlib/ndarray/to-array}}( y )
+ [ [ 4, 3 ], [ 2, 1 ] ]
+
+ See Also
+ --------
+
diff --git a/base/to-reversed/docs/types/index.d.ts b/base/to-reversed/docs/types/index.d.ts
new file mode 100644
index 00000000..8630acfc
--- /dev/null
+++ b/base/to-reversed/docs/types/index.d.ts
@@ -0,0 +1,64 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { ndarray } from '@stdlib/types/ndarray';
+
+/**
+* Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
+*
+* @param x - input array
+* @returns output array
+*
+* @example
+* var typedarray = require( '@stdlib/array/typed' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+*
+* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
+* var shape = [ 3, 2 ];
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
+* // returns
+*
+* var sh = x.shape;
+* // returns [ 3, 2 ]
+*
+* var arr = ndarray2array( x );
+* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
+*
+* var y = toReversed( x );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
+*/
+declare function toReversed( x: T ): T;
+
+
+// EXPORTS //
+
+export = toReversed;
diff --git a/base/to-reversed/docs/types/test.ts b/base/to-reversed/docs/types/test.ts
new file mode 100644
index 00000000..8d03c89f
--- /dev/null
+++ b/base/to-reversed/docs/types/test.ts
@@ -0,0 +1,63 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import empty = require( './../../../../base/empty' );
+import toReversed = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const order = 'row-major';
+ const sh = [ 2, 2 ];
+
+ toReversed( empty( 'float64', sh, order ) ); // $ExpectType float64ndarray
+ toReversed( empty( 'float32', sh, order ) ); // $ExpectType float32ndarray
+ toReversed( empty( 'complex128', sh, order ) ); // $ExpectType complex128ndarray
+ toReversed( empty( 'complex64', sh, order ) ); // $ExpectType complex64ndarray
+ toReversed( empty( 'int32', sh, order ) ); // $ExpectType int32ndarray
+ toReversed( empty( 'int16', sh, order ) ); // $ExpectType int16ndarray
+ toReversed( empty( 'int8', sh, order ) ); // $ExpectType int8ndarray
+ toReversed( empty( 'uint32', sh, order ) ); // $ExpectType uint32ndarray
+ toReversed( empty( 'uint16', sh, order ) ); // $ExpectType uint16ndarray
+ toReversed( empty( 'uint8', sh, order ) ); // $ExpectType uint8ndarray
+ toReversed( empty( 'uint8c', sh, order ) ); // $ExpectType uint8cndarray
+ toReversed( empty( 'generic', sh, order ) ); // $ExpectType genericndarray
+}
+
+// The compiler throws an error if the function is provided an argument which is not an ndarray...
+{
+ toReversed( '10' ); // $ExpectError
+ toReversed( 10 ); // $ExpectError
+ toReversed( false ); // $ExpectError
+ toReversed( true ); // $ExpectError
+ toReversed( null ); // $ExpectError
+ toReversed( [] ); // $ExpectError
+ toReversed( {} ); // $ExpectError
+ toReversed( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = empty( 'float64', [ 2, 2 ], 'row-major' );
+
+ toReversed( x, false ); // $ExpectError
+ toReversed( x, {} ); // $ExpectError
+ toReversed( x, 1, '10', {} ); // $ExpectError
+}
diff --git a/base/to-reversed/examples/index.js b/base/to-reversed/examples/index.js
new file mode 100644
index 00000000..21933390
--- /dev/null
+++ b/base/to-reversed/examples/index.js
@@ -0,0 +1,66 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var array = require( './../../../array' );
+var ndarray2array = require( './../../../to-array' );
+var zeroTo = require( '@stdlib/array/base/zero-to' );
+var toReversed = require( './../lib' );
+
+// Create a linear ndarray buffer:
+var buf = zeroTo( 16 );
+
+// Create a one-dimensional ndarray:
+var x1 = array( buf, {
+ 'shape': [ 16 ]
+});
+
+// Reverse element order:
+var y1 = toReversed( x1, false );
+// returns
+
+var a1 = ndarray2array( y1 );
+console.log( a1 );
+// => [ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ]
+
+// Create a two-dimensional ndarray:
+var x2 = array( buf, {
+ 'shape': [ 4, 4 ]
+});
+
+// Reverse element order:
+var y2 = toReversed( x2, false );
+// returns
+
+var a2 = ndarray2array( y2 );
+console.log( a2 );
+// => [ [ 15, 14, 13, 12 ], [ 11, 10, 9, 8 ], [ 7, 6, 5, 4 ], [ 3, 2, 1, 0 ] ]
+
+// Create a three-dimensional ndarray:
+var x3 = array( buf, {
+ 'shape': [ 2, 4, 2 ]
+});
+
+// Reverse element order:
+var y3 = toReversed( x3, false );
+// returns
+
+var a3 = ndarray2array( y3 );
+console.log( a3 );
+// => [ [ [ 15, 14 ], [ 13, 12 ], [ 11, 10 ], [ 9, 8 ] ], [ [ 7, 6 ], [ 5, 4 ], [ 3, 2 ], [ 1, 0 ] ] ]
diff --git a/base/to-reversed/lib/index.js b/base/to-reversed/lib/index.js
new file mode 100644
index 00000000..e8bc2ac4
--- /dev/null
+++ b/base/to-reversed/lib/index.js
@@ -0,0 +1,62 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Return a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
+*
+* @module @stdlib/ndarray/base/to-reversed
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+* var toReversed = require( '@stdlib/ndarray/base/to-reversed' );
+*
+* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+* var shape = [ 3, 2 ];
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
+* // returns
+*
+* var sh = x.shape;
+* // returns [ 3, 2 ]
+*
+* var arr = ndarray2array( x );
+* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
+*
+* var y = toReversed( x );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/base/to-reversed/lib/main.js b/base/to-reversed/lib/main.js
new file mode 100644
index 00000000..20de7802
--- /dev/null
+++ b/base/to-reversed/lib/main.js
@@ -0,0 +1,82 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var emptyLike = require( './../../../base/empty-like' );
+var reverse = require( './../../../base/reverse' );
+var assign = require( './../../../base/assign' );
+
+
+// MAIN //
+
+/**
+* Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
+*
+* @param {ndarray} x - input array
+* @returns {ndarray} output array
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+*
+* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+* var shape = [ 3, 2 ];
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
+* // returns
+*
+* var sh = x.shape;
+* // returns [ 3, 2 ]
+*
+* var arr = ndarray2array( x );
+* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
+*
+* var y = toReversed( x );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 6.0, 5.0 ], [ 4.0, 3.0 ], [ 2.0, 1.0 ] ]
+*/
+function toReversed( x ) {
+ var out;
+ var xr;
+
+ // Create a reversed view of the input ndarray:
+ xr = reverse( x, false );
+
+ // Create an output ndarray with the same shape and data type as the input ndarray:
+ out = emptyLike( x );
+
+ // Assign the elements of the reversed input ndarray view to the output ndarray:
+ assign( [ xr, out ] );
+
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = toReversed;
diff --git a/base/to-reversed/package.json b/base/to-reversed/package.json
new file mode 100644
index 00000000..83039614
--- /dev/null
+++ b/base/to-reversed/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@stdlib/ndarray/base/to-reversed",
+ "version": "0.0.0",
+ "description": "Return a new ndarray where the order of elements of an input ndarray is reversed along each dimension.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdtypes",
+ "types",
+ "base",
+ "data",
+ "structure",
+ "vector",
+ "ndarray",
+ "matrix",
+ "slice",
+ "view",
+ "reverse",
+ "to-reversed",
+ "flip",
+ "numpy.flip"
+ ]
+}
diff --git a/base/to-reversed/test/test.js b/base/to-reversed/test/test.js
new file mode 100644
index 00000000..759044c0
--- /dev/null
+++ b/base/to-reversed/test/test.js
@@ -0,0 +1,223 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var isReadOnly = require( './../../../base/assert/is-read-only' );
+var zeroTo = require( '@stdlib/array/base/zero-to' );
+var typedarray = require( '@stdlib/array/typed' );
+var scalar2ndarray = require( './../../../base/from-scalar' );
+var ndarray2array = require( './../../../to-array' );
+var baseCtor = require( './../../../base/ctor' );
+var ctor = require( './../../../ctor' );
+var toReversed = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof toReversed, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a new zero-dimensional array (base)', function test( t ) {
+ var actual;
+ var x;
+
+ x = scalar2ndarray( 3.14, 'float64', 'row-major' );
+
+ actual = toReversed( x );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 0, 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.strictEqual( actual.get(), x.get(), 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a new zero-dimensional array (base, offset)', function test( t ) {
+ var actual;
+ var x;
+
+ x = new baseCtor( 'float64', typedarray( zeroTo( 4 ), 'float64' ), [], [ 0 ], 3, 'row-major' );
+
+ actual = toReversed( x );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 0, 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.strictEqual( actual.get(), 3, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a new zero-dimensional array (non-base, offset, read-only)', function test( t ) {
+ var actual;
+ var x;
+
+ x = new ctor( 'float64', typedarray( zeroTo( 4 ), 'float64' ), [], [ 0 ], 3, 'row-major' );
+
+ actual = toReversed( x );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 0, 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.strictEqual( actual.get(), 3, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a new zero-dimensional array (non-base, offset, writable)', function test( t ) {
+ var actual;
+ var x;
+
+ x = new ctor( 'float64', typedarray( zeroTo( 4 ), 'float64' ), [], [ 0 ], 3, 'row-major' );
+
+ actual = toReversed( x );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 0, 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.strictEqual( actual.get(), 3, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a new ndarray where the order of the elements of an input ndarray is reversed along each dimension (ndims=1)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+ var i;
+
+ buf = typedarray( zeroTo( 30 ), 'float64' );
+ sh = [ 6 ];
+ st = [ 2 ];
+ o = 4;
+ ord = 'row-major';
+
+ x = new ctor( 'float64', buf, sh, st, o, ord );
+
+ actual = toReversed( x );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 1, 'returns expected value' );
+ t.strictEqual( actual.length, 6, 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+
+ expected = [ 14, 12, 10, 8, 6, 4 ];
+ for ( i = 0; i < expected.length; i++ ) {
+ t.strictEqual( actual.iget( i ), expected[ i ], 'returns expected value' );
+ }
+ t.end();
+});
+
+tape( 'the function returns a new ndarray where the order of the elements of an input ndarray is reversed along each dimension (ndims=2)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = typedarray( zeroTo( 30 ), 'float64' );
+ sh = [ 4, 3 ];
+ st = [ 6, 2 ];
+ o = 4;
+ ord = 'row-major';
+
+ x = new ctor( 'float64', buf, sh, st, o, ord );
+
+ actual = toReversed( x );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 2, 'returns expected value' );
+ t.deepEqual( actual.shape, [ 4, 3 ], 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+
+ expected = [
+ [ 26, 24, 22 ],
+ [ 20, 18, 16 ],
+ [ 14, 12, 10 ],
+ [ 8, 6, 4 ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a new ndarray where the order of the elements of an input ndarray is reversed along each dimension (ndims=3)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = typedarray( zeroTo( 100 ), 'float64' );
+ sh = [ 2, 4, 3 ];
+ st = [ 24, 6, 2 ];
+ o = 10;
+ ord = 'row-major';
+
+ x = new ctor( 'float64', buf, sh, st, o, ord );
+
+ actual = toReversed( x );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.ndims, 3, 'returns expected value' );
+ t.deepEqual( actual.shape, [ 2, 4, 3 ], 'returns expected value' );
+ t.strictEqual( actual.dtype, x.dtype, 'returns expected value' );
+ t.notEqual( actual.data, x.data, 'returns expected value' );
+
+ expected = [
+ [
+ [ 56, 54, 52 ],
+ [ 50, 48, 46 ],
+ [ 44, 42, 40 ],
+ [ 38, 36, 34 ]
+ ],
+ [
+ [ 32, 30, 28 ],
+ [ 26, 24, 22 ],
+ [ 20, 18, 16 ],
+ [ 14, 12, 10 ]
+ ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});