diff --git a/base/flipud/README.md b/base/flipud/README.md
new file mode 100644
index 00000000..b6b589e6
--- /dev/null
+++ b/base/flipud/README.md
@@ -0,0 +1,153 @@
+
+
+# flipud
+
+> Return a view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var flipud = require( '@stdlib/ndarray/base/flipud' );
+```
+
+#### flipud( x, writable )
+
+Returns a view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.
+
+```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 = flipud( x, false );
+// returns
+
+sh = y.shape;
+// returns [ 3, 2 ]
+
+arr = ndarray2array( y );
+// returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
+```
+
+The function accepts the following arguments:
+
+- **x**: input ndarray.
+- **writable**: boolean indicating whether a returned ndarray should be writable.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- If provided a zero-dimensional ndarray, as the ndarray has no dimensions to reverse, the function simply returns a new view of the input ndarray. Similarly, if provided a one-dimensional ndarray, as the ndarray has only one dimension, the function simply returns a new view of the input ndarray.
+- The `writable` parameter **only** applies to ndarray constructors supporting **read-only** instances.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var zeroTo = require( '@stdlib/array/base/zero-to' );
+var flipud = require( '@stdlib/ndarray/base/flipud' );
+
+// Create a linear ndarray buffer:
+var buf = zeroTo( 16 );
+
+// Create a three-dimensional ndarray:
+var x = array( buf, {
+ 'shape': [ 2, 4, 2 ]
+});
+
+// Reverse the order of second-to-last dimension:
+var y = flipud( x, false );
+// returns
+
+var a = ndarray2array( y );
+// returns [ [ [ 6, 7 ], [ 4, 5 ], [ 2, 3 ], [ 0, 1 ] ], [ [ 14, 15 ], [ 12, 13 ], [ 10, 11 ], [ 8, 9 ] ] ]
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/base/flipud/benchmark/benchmark.js b/base/flipud/benchmark/benchmark.js
new file mode 100644
index 00000000..c8c93b38
--- /dev/null
+++ b/base/flipud/benchmark/benchmark.js
@@ -0,0 +1,331 @@
+/**
+* @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.
+*/
+
+'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 flipud = require( './../lib' );
+
+
+// MAIN //
+
+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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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 = flipud( values[ i%values.length ], false );
+ 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/flipud/docs/repl.txt b/base/flipud/docs/repl.txt
new file mode 100644
index 00000000..53ec999f
--- /dev/null
+++ b/base/flipud/docs/repl.txt
@@ -0,0 +1,42 @@
+
+{{alias}}( x, writable )
+ Returns a view of an input ndarray in which the order of elements along the
+ second-to-last dimension is reversed.
+
+ If provided a zero-dimensional ndarray, as the ndarray has no dimensions to
+ reverse, the function simply returns a new view of the input ndarray.
+
+ If provided a one-dimensional ndarray, as the ndarray has only one
+ dimension, the function simply returns a new view of the input ndarray.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ writable: boolean
+ Boolean indicating whether a returned ndarray should be writable. This
+ parameter only applies to ndarray constructors which support read-only
+ instances.
+
+ Returns
+ -------
+ out: ndarray
+ Output array view.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] )
+
+ > x.shape
+ [ 2, 2 ]
+ > var y = {{alias}}( x, false )
+
+ > y.shape
+ [ 2, 2 ]
+ > {{alias:@stdlib/ndarray/to-array}}( y )
+ [ [ 3, 4 ], [ 1, 2 ] ]
+
+ See Also
+ --------
+
diff --git a/base/flipud/docs/types/index.d.ts b/base/flipud/docs/types/index.d.ts
new file mode 100644
index 00000000..897ea844
--- /dev/null
+++ b/base/flipud/docs/types/index.d.ts
@@ -0,0 +1,497 @@
+/*
+* @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.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray';
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 ], '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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
+*/
+declare function flipud( x: float64ndarray, writable: boolean ): float64ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
+*/
+declare function flipud( x: float32ndarray, writable: boolean ): float32ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: int32ndarray, writable: boolean ): int32ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: int16ndarray, writable: boolean ): int16ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: int8ndarray, writable: boolean ): int8ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: uint32ndarray, writable: boolean ): uint32ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: uint16ndarray, writable: boolean ): uint16ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: uint8ndarray, writable: boolean ): uint8ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: uint8cndarray, writable: boolean ): uint8cndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*/
+declare function flipud( x: complex128ndarray, writable: boolean ): complex128ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*/
+declare function flipud( x: complex64ndarray, writable: boolean ): complex64ndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: genericndarray, writable: boolean ): genericndarray;
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
+*/
+declare function flipud( x: typedndarray, writable: boolean ): typedndarray;
+
+
+// EXPORTS //
+
+export = flipud;
diff --git a/base/flipud/docs/types/test.ts b/base/flipud/docs/types/test.ts
new file mode 100644
index 00000000..0692c63c
--- /dev/null
+++ b/base/flipud/docs/types/test.ts
@@ -0,0 +1,95 @@
+/*
+* @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.
+*/
+
+import empty = require( './../../../../base/empty' );
+import flipud = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const order = 'row-major';
+ const sh = [ 2, 2 ];
+
+ flipud( empty( 'float64', sh, order ), false ); // $ExpectType float64ndarray
+ flipud( empty( 'float32', sh, order ), false ); // $ExpectType float32ndarray
+ flipud( empty( 'complex128', sh, order ), false ); // $ExpectType complex128ndarray
+ flipud( empty( 'complex64', sh, order ), false ); // $ExpectType complex64ndarray
+ flipud( empty( 'int32', sh, order ), false ); // $ExpectType int32ndarray
+ flipud( empty( 'int16', sh, order ), false ); // $ExpectType int16ndarray
+ flipud( empty( 'int8', sh, order ), false ); // $ExpectType int8ndarray
+ flipud( empty( 'uint32', sh, order ), false ); // $ExpectType uint32ndarray
+ flipud( empty( 'uint16', sh, order ), false ); // $ExpectType uint16ndarray
+ flipud( empty( 'uint8', sh, order ), false ); // $ExpectType uint8ndarray
+ flipud( empty( 'uint8c', sh, order ), false ); // $ExpectType uint8cndarray
+
+ flipud( empty( 'float64', sh, order ), true ); // $ExpectType float64ndarray
+ flipud( empty( 'float32', sh, order ), true ); // $ExpectType float32ndarray
+ flipud( empty( 'complex128', sh, order ), true ); // $ExpectType complex128ndarray
+ flipud( empty( 'complex64', sh, order ), true ); // $ExpectType complex64ndarray
+ flipud( empty( 'int32', sh, order ), true ); // $ExpectType int32ndarray
+ flipud( empty( 'int16', sh, order ), true ); // $ExpectType int16ndarray
+ flipud( empty( 'int8', sh, order ), true ); // $ExpectType int8ndarray
+ flipud( empty( 'uint32', sh, order ), true ); // $ExpectType uint32ndarray
+ flipud( empty( 'uint16', sh, order ), true ); // $ExpectType uint16ndarray
+ flipud( empty( 'uint8', sh, order ), true ); // $ExpectType uint8ndarray
+ flipud( empty( 'uint8c', sh, order ), true ); // $ExpectType uint8cndarray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ flipud( '10', false ); // $ExpectError
+ flipud( 10, false ); // $ExpectError
+ flipud( false, false ); // $ExpectError
+ flipud( true, false ); // $ExpectError
+ flipud( null, false ); // $ExpectError
+ flipud( [], false ); // $ExpectError
+ flipud( {}, false ); // $ExpectError
+ flipud( ( x: number ): number => x, false ); // $ExpectError
+
+ flipud( '10', true ); // $ExpectError
+ flipud( 10, true ); // $ExpectError
+ flipud( false, true ); // $ExpectError
+ flipud( true, true ); // $ExpectError
+ flipud( null, true ); // $ExpectError
+ flipud( [], true ); // $ExpectError
+ flipud( {}, true ); // $ExpectError
+ flipud( ( x: number ): number => x, true ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a boolean...
+{
+ const x = empty( 'float64', [ 2, 2 ], 'row-major' );
+
+ flipud( x, '5' ); // $ExpectError
+ flipud( x, 5 ); // $ExpectError
+ flipud( x, null ); // $ExpectError
+ flipud( x, undefined ); // $ExpectError
+ flipud( x, [ '5' ] ); // $ExpectError
+ flipud( x, {} ); // $ExpectError
+ flipud( x, ( 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' );
+
+ flipud( x ); // $ExpectError
+ flipud( x, false, {} ); // $ExpectError
+}
diff --git a/base/flipud/examples/index.js b/base/flipud/examples/index.js
new file mode 100644
index 00000000..5b23295b
--- /dev/null
+++ b/base/flipud/examples/index.js
@@ -0,0 +1,40 @@
+/**
+* @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.
+*/
+
+'use strict';
+
+var array = require( './../../../array' );
+var ndarray2array = require( './../../../to-array' );
+var zeroTo = require( '@stdlib/array/base/zero-to' );
+var flipud = require( './../lib' );
+
+// Create a linear ndarray buffer:
+var buf = zeroTo( 16 );
+
+// Create a three-dimensional ndarray:
+var x = array( buf, {
+ 'shape': [ 2, 4, 2 ]
+});
+
+// Reverse the order of second-to-last dimension:
+var y = flipud( x, false );
+// returns
+
+var a = ndarray2array( y );
+console.log( a );
+// => [ [ [ 6, 7 ], [ 4, 5 ], [ 2, 3 ], [ 0, 1 ] ], [ [ 14, 15 ], [ 12, 13 ], [ 10, 11 ], [ 8, 9 ] ] ]
diff --git a/base/flipud/lib/index.js b/base/flipud/lib/index.js
new file mode 100644
index 00000000..5a2a6c40
--- /dev/null
+++ b/base/flipud/lib/index.js
@@ -0,0 +1,62 @@
+/**
+* @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.
+*/
+
+'use strict';
+
+/**
+* Return a view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.
+*
+* @module @stdlib/ndarray/base/flipud
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+* var flipud = require( '@stdlib/ndarray/base/flipud' );
+*
+* 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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/base/flipud/lib/main.js b/base/flipud/lib/main.js
new file mode 100644
index 00000000..3c2d494b
--- /dev/null
+++ b/base/flipud/lib/main.js
@@ -0,0 +1,84 @@
+/**
+* @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.
+*/
+
+'use strict';
+
+// MODULES //
+
+var MultiSlice = require( '@stdlib/slice/multi' );
+var reverseDimension = require( './../../../base/reverse-dimension' );
+var slice = require( './../../../base/slice' );
+var ndims = require( './../../../base/ndims' );
+
+
+// MAIN //
+
+/**
+* Returns a view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.
+*
+* @param {ndarray} x - input array
+* @param {boolean} writable - boolean indicating whether a returned array should be writable
+* @returns {ndarray} ndarray view
+*
+* @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 = flipud( x, false );
+* // returns
+*
+* sh = y.shape;
+* // returns [ 3, 2 ]
+*
+* arr = ndarray2array( y );
+* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
+*/
+function flipud( x, writable ) {
+ var N = ndims( x );
+
+ // Check whether we were provided a zero-dimensional array...
+ if ( N === 0 ) {
+ // Nothing to reverse, so just return a new view:
+ return slice( x, new MultiSlice(), true, writable );
+ }
+ // Check whether we were provided a one-dimensional array...
+ if ( N === 1 ) {
+ // No second-to-last dimension to reverse, so just return a new view:
+ return slice( x, new MultiSlice( null ), true, writable );
+ }
+ return reverseDimension( x, -2, writable );
+}
+
+
+// EXPORTS //
+
+module.exports = flipud;
diff --git a/base/flipud/package.json b/base/flipud/package.json
new file mode 100644
index 00000000..f4acf3f3
--- /dev/null
+++ b/base/flipud/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/ndarray/base/flipud",
+ "version": "0.0.0",
+ "description": "Return a view of an input ndarray in which the order of elements along the second-to-last dimension is reversed.",
+ "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",
+ "flip",
+ "numpy.flipud"
+ ]
+}
diff --git a/base/flipud/test/test.js b/base/flipud/test/test.js
new file mode 100644
index 00000000..253e893f
--- /dev/null
+++ b/base/flipud/test/test.js
@@ -0,0 +1,372 @@
+/**
+* @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.
+*/
+
+'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 ndarray2array = require( './../../../to-array' );
+var baseCtor = require( './../../../base/ctor' );
+var scalar2ndarray = require( './../../../base/from-scalar' );
+var ctor = require( './../../../ctor' );
+var flipud = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof flipud, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a zero-dimensional array view (base)', function test( t ) {
+ var actual;
+ var x;
+
+ x = scalar2ndarray( 3.14, 'float64', 'row-major' );
+
+ actual = flipud( x, false );
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a zero-dimensional array view (base, offset)', function test( t ) {
+ var actual;
+ var x;
+
+ x = new baseCtor( 'float64', typedarray( zeroTo( 4 ), 'float64' ), [], [ 0 ], 3, 'row-major' );
+
+ actual = flipud( x, false );
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a zero-dimensional array view (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 = flipud( x, false );
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a zero-dimensional input array, the function returns a zero-dimensional array view (non-base, offset, writable)', function test( t ) {
+ var actual;
+ var x;
+
+ x = new ctor( 'float64', typedarray( zeroTo( 4 ), 'float64' ), [], [ 0 ], 3, 'row-major' );
+
+ actual = flipud( x, true );
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'when provided a one-dimensional input array, the function returns a view of a provided input array', 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 = flipud( x, false );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+
+ expected = [ 4, 6, 8, 10, 12, 14 ];
+ for ( i = 0; i < expected.length; i++ ) {
+ t.strictEqual( actual.iget( i ), expected[ i ], 'returns expected value' );
+ }
+ t.end();
+});
+
+tape( 'the function returns a view of a provided input array (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 = flipud( x, false );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+
+ expected = [
+ [ 22, 24, 26 ],
+ [ 16, 18, 20 ],
+ [ 10, 12, 14 ],
+ [ 4, 6, 8 ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a view of a provided input array (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 = flipud( x, false );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+
+ expected = [
+ [
+ [ 28, 30, 32 ],
+ [ 22, 24, 26 ],
+ [ 16, 18, 20 ],
+ [ 10, 12, 14 ]
+ ],
+ [
+ [ 52, 54, 56 ],
+ [ 46, 48, 50 ],
+ [ 40, 42, 44 ],
+ [ 34, 36, 38 ]
+ ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an ndarray having a constructor supporting read-only instances, the function supports returning a writable view (non-base, 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 = flipud( x, true );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ expected = [ 4, 6, 8, 10, 12, 14 ];
+ for ( i = 0; i < expected.length; i++ ) {
+ t.strictEqual( actual.iget( i ), expected[ i ], 'returns expected value' );
+ }
+ t.end();
+});
+
+tape( 'if provided an ndarray having a constructor supporting read-only instances, the function supports returning a writable view (non-base, 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 = flipud( x, true );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ expected = [
+ [ 22, 24, 26 ],
+ [ 16, 18, 20 ],
+ [ 10, 12, 14 ],
+ [ 4, 6, 8 ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided an ndarray having a constructor which does not support read-only instances, the function is not guaranteed to return either a read-only or writable view (base, 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 baseCtor( 'float64', buf, sh, st, o, ord );
+
+ actual = flipud( x, false );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ expected = [ 4, 6, 8, 10, 12, 14 ];
+ for ( i = 0; i < expected.length; i++ ) {
+ t.strictEqual( actual.iget( i ), expected[ i ], 'returns expected value' );
+ }
+ t.end();
+});
+
+tape( 'if provided an ndarray having a constructor which does not support read-only instances, the function is not guaranteed to return either a read-only or writable view (base, 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 baseCtor( 'float64', buf, sh, st, o, ord );
+
+ actual = flipud( x, false );
+
+ 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.strictEqual( actual.data, x.data, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns expected value' );
+
+ expected = [
+ [ 22, 24, 26 ],
+ [ 16, 18, 20 ],
+ [ 10, 12, 14 ],
+ [ 4, 6, 8 ]
+ ];
+ actual = ndarray2array( actual );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
diff --git a/base/lib/index.js b/base/lib/index.js
index a1c46913..ff978c33 100644
--- a/base/lib/index.js
+++ b/base/lib/index.js
@@ -310,6 +310,15 @@ setReadOnly( ns, 'expandDimensions', require( './../../base/expand-dimensions' )
*/
setReadOnly( ns, 'fliplr', require( './../../base/fliplr' ) );
+/**
+* @name flipud
+* @memberof ns
+* @readonly
+* @type {Function}
+* @see {@link module:@stdlib/ndarray/base/flipud}
+*/
+setReadOnly( ns, 'flipud', require( './../../base/flipud' ) );
+
/**
* @name scalar2ndarray
* @memberof ns
diff --git a/dist/index.js b/dist/index.js
index 13ba8a9a..89e8a078 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,4 +1,4 @@
-"use strict";var V=function(r,a){return function(){return a||r((a={exports:{}}).exports,a),a.exports}};var Cv=V(function(uK,zv){"use strict";function Gh(r){var a,e,i,t;for(a=r.length,e=[],t=0;t=0;t--)e[t]=i,i*=r[t];return e}function Jh(r){var a,e,i;for(a=[],e=1,i=0;i=0;t--)a[t]=i,i*=r[t];return a}function Wh(r,a){var e,i;for(e=1,i=0;it&&(i=!1),i||a)t=v;else return 0;return i&&a?3:i?1:2}Kv.exports=a6});var Te=V(function(pK,Jv){"use strict";var i6=Gv();Jv.exports=i6});var Xv=V(function(mK,Zv){"use strict";function v6(r){var a,e,i;if(a=r.length,a===0)return 0;for(e=1,i=0;i0?v+=s*(r[o]-1):s<0&&(t+=s*(r[o]-1))}return[t,v]}bt.exports=T6});var jt=V(function(NK,wt){"use strict";function k6(r,a,e,i){var t,v,s,o,u;for(t=r.length,v=e,s=e,u=0;u0?s+=o*(r[u]-1):o<0&&(v+=o*(r[u]-1))}return i[0]=v,i[1]=s,i}wt.exports=k6});var ye=V(function(RK,_t){"use strict";var I6=require("@stdlib/utils/define-nonenumerable-read-only-property"),Et=St(),A6=jt();I6(Et,"assign",A6);_t.exports=Et});var Tt=V(function(DK,Ot){"use strict";var N6=ye();function R6(r,a,e,i){var t=N6(a,e,i);return t[0]>=0&&t[1]=0;s--)v=r%e[s],r-=v,r/=e[s],t+=v*a[s];return this._accessors?this._buffer.get(t):this._buffer[t]}Kt.exports=G6});var Zt=V(function(GK,Jt){"use strict";function J6(r,a){var e,i,t,v,s,o;if(t=this._ndims,t===0)return this._accessors?this._buffer.set(r,this._offset):this._buffer[this._offset]=r,this;if(this._flags.ROW_MAJOR_CONTIGUOUS||this._flags.COLUMN_MAJOR_CONTIGUOUS){if(this._iterationOrder===1)return this._accessors?this._buffer.set(a,this._offset+r):this._buffer[this._offset+r]=a,this;if(this._iterationOrder===-1)return this._accessors?this._buffer.set(a,this._offset-r):this._buffer[this._offset-r]=a,this}if(i=this._shape,e=this._strides,v=this._offset,this._order==="column-major"){for(o=0;o=0;o--)s=r%i[o],r-=s,r/=i[o],v+=s*e[o];return this._accessors?this._buffer.set(a,v):this._buffer[v]=a,this}Jt.exports=J6});var Wt=V(function(JK,Xt){"use strict";function Z6(){var r,a;for(r=this._offset,a=0;a=0;s--)v=this.iget(this._length-1-s),r+=di(v)+", "+li(v),s>0&&(r+=", ");else for(s=2;s>=0;s--)r+=this.iget(this._length-1-s),s>0&&(r+=", ")}if(e=rb[this.dtype],i+=$6(e,"{{data}}",r),i+=", ",a===0?i+="[]":i+="[ "+this._shape.join(", ")+" ]",i+=", ",i+="[ ",a===0)i+="0";else for(s=0;sa?a:r}js.exports=Xb});var pi=V(function(uG,_s){"use strict";var Wb=Es();_s.exports=Wb});var Ts=V(function(fG,Os){"use strict";function Qb(r,a){var e=a+1;return r<0?(r+=e,r<0&&(r%=e,r!==0&&(r+=e)),r):(r>a&&(r-=e,r>a&&(r%=e)),r)}Os.exports=Qb});var mi=V(function(dG,ks){"use strict";var Hb=Ts();ks.exports=Hb});var As=V(function(lG,Is){"use strict";var $b=pi(),r5=mi(),e5=require("@stdlib/string/format");function a5(r,a,e){if(e==="clamp")return $b(r,a);if(e==="wrap")return r5(r,a);if(r<0||r>a)throw new RangeError(e5("invalid argument. Index must be on the interval: [0, %d]. Value: `%d`.",a,r));return r}Is.exports=a5});var Le=V(function(cG,Ns){"use strict";var i5=As();Ns.exports=i5});var zs=V(function(yG,Ds){"use strict";var v5=require("@stdlib/assert/is-integer").isPrimitive,t5=Le(),s5=ee(),o5=require("@stdlib/string/format"),Rs=s5.prototype.iget;function n5(r){if(this._ndims>0){if(!v5(r))throw new TypeError(o5("invalid argument. Index must be an integer. Value: `%s`.",r));return r=t5(r,this._length-1,this._mode),Rs.call(this,r)}return Rs.call(this)}Ds.exports=n5});var Ps=V(function(pG,Ls){"use strict";var u5=require("@stdlib/assert/is-integer").isPrimitive,f5=Le(),d5=ee(),l5=require("@stdlib/string/format"),Cs=d5.prototype.iset;function c5(r,a){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!u5(r))throw new TypeError(l5("invalid argument. Index must be an integer. Value: `%s`.",r));r=f5(r,this._length-1,this._mode),Cs.call(this,r,a)}else Cs.call(this,r);return this}Ls.exports=c5});var Bs=V(function(mG,Ms){"use strict";var y5=require("@stdlib/assert/is-integer").isPrimitive,p5=Le(),Vs=require("@stdlib/string/format");function m5(){var r,a,e,i;if(arguments.length!==this._ndims)throw new RangeError(Vs("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(r=this._offset,e=this._submode.length,i=0;i0))throw new TypeError(ue("invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.",e));if(o=e.length,o>io)throw new RangeError(ue("invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.",io,o));if(!A5(i))throw new TypeError(ue("invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.",i));if(o>0){if(i.length!==o)throw new RangeError(ue("invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.",o,i.length))}else{if(i.length!==1)throw new RangeError("invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.");if(i[0]!==0)throw new RangeError(ue("invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.",i[0]))}if(!I5(t))throw new TypeError(ue("invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.",t));if(!N5(v))throw new TypeError(ue("invalid argument. Sixth argument must be a supported order. Value: `%s`.",v));if(o>0&&!D5(a.length,e,i,t)&&z5(e)>0)throw new Error("invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.");if(u={},u.mode=F5,u.readonly=Y5,arguments.length>6&&(f=U5(u,s),f))throw f;return this._mode=u.mode,u.submode===void 0&&(u.submode=[this._mode]),this._submode=u.submode,n=ao(e,o),d=ao(i,o||1),vo.call(this,r,a,n,d,t,v),this._flags.READONLY=u.readonly,this}L5(fe,vo);aa(fe,"name","ndarray");aa(fe.prototype,"get",M5);aa(fe.prototype,"iget",P5);aa(fe.prototype,"set",B5);aa(fe.prototype,"iset",V5);to.exports=fe});var de=V(function(wG,oo){"use strict";var K5=so();oo.exports=K5});var no=V(function(jG,G5){G5.exports=["none","equiv","safe","mostly-safe","same-kind","unsafe"]});var fo=V(function(EG,uo){"use strict";var J5=no();function Z5(){return J5.slice()}uo.exports=Z5});var co=V(function(_G,lo){"use strict";function X5(){return{none:0,equiv:1,safe:2,"mostly-safe":3,"same-kind":4,unsafe:5}}lo.exports=X5});var gi=V(function(OG,po){"use strict";var W5=require("@stdlib/utils/define-nonenumerable-read-only-property"),yo=fo(),Q5=co();W5(yo,"enum",Q5);po.exports=yo});var go=V(function(TG,xo){"use strict";var H5=gi(),mo=H5(),$5=mo.length;function rS(r){var a;for(a=0;a<$5;a++)if(r===mo[a])return!0;return!1}xo.exports=rS});var qi=V(function(kG,qo){"use strict";var eS=go();qo.exports=eS});var bo=V(function(IG,ho){"use strict";var aS=require("@stdlib/utils/object-inverse"),iS=Fr().enum,vS=aS(iS(),{duplicates:!1});function tS(r){var a=vS[r];return typeof a=="string"?a:null}ho.exports=tS});var ha=V(function(AG,So){"use strict";var sS=bo();So.exports=sS});var jo=V(function(NG,wo){"use strict";var oS=Fr().enum,nS=oS();function uS(r){var a=nS[r];return typeof a=="number"?a:null}wo.exports=uS});var ia=V(function(RG,Eo){"use strict";var fS=jo();Eo.exports=fS});var Oo=V(function(DG,_o){"use strict";var dS=ha(),lS=ia();function cS(r){var a=typeof r;return a==="string"?lS(r)===null?null:r:a==="number"?dS(r):null}_o.exports=cS});var ae=V(function(zG,To){"use strict";var yS=Oo();To.exports=yS});var ko=V(function(CG,pS){pS.exports={float64:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var No=V(function(LG,Ao){"use strict";var Io=require("@stdlib/utils/keys"),mS=require("@stdlib/assert/has-own-property"),xS=ae(),Sa=ko(),ba;function gS(){var r,a,e,i,t,v,s,o,u;for(e={},r=Io(Sa),a=r.length,u=0;u0}Do.exports=jS});var wa=V(function(MG,Co){"use strict";var ES=zo();Co.exports=ES});var Lo=V(function(BG,_S){_S.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var Mo=V(function(UG,Vo){"use strict";var Po=require("@stdlib/utils/keys"),OS=require("@stdlib/assert/has-own-property"),TS=ae(),Ea=Lo(),ja;function kS(){var r,a,e,i,t,v,s,o,u;for(e={},r=Po(Ea),a=r.length,u=0;u0}Uo.exports=zS});var _a=V(function(KG,Yo){"use strict";var CS=Fo();Yo.exports=CS});var Ko=V(function(GG,LS){LS.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var Zo=V(function(JG,Jo){"use strict";var Go=require("@stdlib/utils/keys"),PS=require("@stdlib/assert/has-own-property"),VS=ae(),Ta=Ko(),Oa;function MS(){var r,a,e,i,t,v,s,o,u;for(e={},r=Go(Ta),a=r.length,u=0;u0}Wo.exports=GS});var wi=V(function(WG,Ho){"use strict";var JS=Qo();Ho.exports=JS});var rn=V(function(QG,$o){"use strict";var ZS=wa(),XS=_a(),WS=wi();function QS(r,a,e){return e==="unsafe"||r===a?!0:e==="none"||e==="equiv"?!1:e==="safe"?ZS(r,a):e==="mostly-safe"?XS(r,a):WS(r,a)}$o.exports=QS});var ji=V(function(HG,en){"use strict";var HS=rn();en.exports=HS});var vn=V(function($G,an){"use strict";var $S=require("@stdlib/buffer/ctor"),r8=require("@stdlib/array/float64"),e8=require("@stdlib/array/float32"),a8=require("@stdlib/array/int16"),i8=require("@stdlib/array/int32"),v8=require("@stdlib/array/int8"),t8=require("@stdlib/array/uint16"),s8=require("@stdlib/array/uint32"),o8=require("@stdlib/array/uint8"),n8=require("@stdlib/array/uint8c"),u8=require("@stdlib/array/complex64"),f8=require("@stdlib/array/complex128"),d8={binary:$S,float64:r8,float32:e8,generic:Array,int16:a8,int32:i8,int8:v8,uint16:t8,uint32:s8,uint8:o8,uint8c:n8,complex64:u8,complex128:f8};an.exports=d8});var sn=V(function(rJ,tn){"use strict";var l8=vn();function c8(r){return l8[r]||null}tn.exports=c8});var va=V(function(eJ,on){"use strict";var y8=sn();on.exports=y8});var un=V(function(aJ,nn){"use strict";function p8(r){var a;for(a=0;a=0&&r.length=qj(a)}gu.exports=hj});var bu=V(function(RJ,hu){"use strict";var bj=qu();hu.exports=bj});var ju=V(function(DJ,wu){"use strict";var Su=require("@stdlib/math/base/special/abs");function Sj(r){var a,e,i,t;if(a=r.length,a===0)return!1;for(e=Su(r[0]),t=1;te)return!1;e=i}return!0}sf.exports=u7});var Ri=V(function(iZ,nf){"use strict";var f7=of();nf.exports=f7});var ff=V(function(vZ,uf){"use strict";var d7=ta(),l7=ne(),c7=Ri();function y7(r,a,e){return l7(a)!==0&&c7(a)&&d7(r,a,e)}uf.exports=y7});var lf=V(function(tZ,df){"use strict";var p7=ff();df.exports=p7});var yf=V(function(sZ,cf){"use strict";var m7=require("@stdlib/array/base/assert/contains").factory,x7=Fr(),g7=m7(x7("signed_integer"));cf.exports=g7});var za=V(function(oZ,pf){"use strict";var q7=yf();pf.exports=q7});var xf=V(function(nZ,mf){"use strict";var h7=require("@stdlib/array/base/assert/contains").factory,b7=Fr(),S7=h7(b7("unsigned_integer"));mf.exports=S7});var Ca=V(function(uZ,gf){"use strict";var w7=xf();gf.exports=w7});var hf=V(function(fZ,qf){"use strict";var Pr=require("@stdlib/utils/define-read-only-property"),Lr={};Pr(Lr,"isAllowedDataTypeCast",ji());Pr(Lr,"isBufferLengthCompatible",fi());Pr(Lr,"isBufferLengthCompatibleShape",bu());Pr(Lr,"isCastingMode",qi());Pr(Lr,"isColumnMajor",ki());Pr(Lr,"isColumnMajorContiguous",Nu());Pr(Lr,"isComplexFloatingPointDataType",sa());Pr(Lr,"isContiguous",Vu());Pr(Lr,"isDataType",Ce());Pr(Lr,"isFloatingPointDataType",Ra());Pr(Lr,"isIndexMode",ea());Pr(Lr,"isIntegerDataType",Ii());Pr(Lr,"isMostlySafeDataTypeCast",_a());Pr(Lr,"isNumericDataType",Ai());Pr(Lr,"isOrder",$r());Pr(Lr,"isReadOnly",je());Pr(Lr,"isRealDataType",Da());Pr(Lr,"isRealFloatingPointDataType",Ni());Pr(Lr,"isRowMajor",Ri());Pr(Lr,"isRowMajorContiguous",lf());Pr(Lr,"isSafeDataTypeCast",wa());Pr(Lr,"isSameKindDataTypeCast",wi());Pr(Lr,"isSignedIntegerDataType",za());Pr(Lr,"isSingleSegmentCompatible",ta());Pr(Lr,"isUnsignedIntegerDataType",Ca());qf.exports=Lr});var Sf=V(function(dZ,bf){"use strict";function j7(r){return r.dtype}bf.exports=j7});var Zr=V(function(lZ,wf){"use strict";var E7=Sf();wf.exports=E7});var Ef=V(function(cZ,jf){"use strict";var _7=require("@stdlib/array/base/copy-indexed");function O7(r,a){var e=r.shape;return a?_7(e):e}jf.exports=O7});var Kr=V(function(yZ,_f){"use strict";var T7=Ef();_f.exports=T7});var Tf=V(function(pZ,Of){"use strict";var k7=Yr(),I7=require("@stdlib/array/base/copy-indexed"),A7="row-major";function N7(r,a){var e,i,t;return t=r.strides,typeof t!="object"||t===null?(i=r.shape,i.length===0?[0]:(e=r.order,typeof e!="string"&&(e=A7),k7(i,e))):a?I7(t):t}Of.exports=N7});var se=V(function(mZ,kf){"use strict";var R7=Tf();kf.exports=R7});var Af=V(function(xZ,If){"use strict";var D7=Gr();function z7(r){var a,e,i;return i=r.offset,typeof i=="number"?i:(e=r.shape,e.length===0||(a=r.strides,typeof a!="object"||a===null)?0:D7(e,a))}If.exports=z7});var le=V(function(gZ,Nf){"use strict";var C7=Af();Nf.exports=C7});var Df=V(function(qZ,Rf){"use strict";var L7=Te(),Di="row-major",P7="column-major";function V7(r){var a,e;return e=r.order,typeof e=="string"?e:(a=r.strides,typeof a!="object"||a===null||(e=L7(a),e===1||e===3)?Di:e===2?P7:r.shape.length===0?Di:null)}Rf.exports=V7});var Xr=V(function(hZ,zf){"use strict";var M7=Df();zf.exports=M7});var Lf=V(function(bZ,Cf){"use strict";function B7(r){return r.data}Cf.exports=B7});var me=V(function(SZ,Pf){"use strict";var U7=Lf();Pf.exports=U7});var Mf=V(function(wZ,Vf){"use strict";var F7=require("@stdlib/array/base/assert/is-accessor-array"),Y7=require("@stdlib/array/base/accessor-getter"),K7=require("@stdlib/array/base/accessor-setter"),G7=require("@stdlib/array/base/getter"),J7=require("@stdlib/array/base/setter"),Z7=Cr(),X7=Zr(),W7=Kr(),Q7=se(),H7=le(),$7=Xr(),rE=me();function eE(r){var a,e,i,t;return a=rE(r),i=W7(r,!0),t=X7(r),e=F7(a),{ref:r,dtype:t,data:a,length:Z7(i),shape:i,strides:Q7(r,!0),offset:H7(r),order:$7(r),accessorProtocol:e,accessors:e?[Y7(t),K7(t)]:[G7(t),J7(t)]}}Vf.exports=eE});var Be=V(function(jZ,Bf){"use strict";var aE=Mf();Bf.exports=aE});var Ff=V(function(EZ,Uf){"use strict";function iE(r,a){var e,i,t,v,s,o,u,f,n,d;for(t=1,v=1,d=1;d=0&&(n=r[s],i=n<0?-n:n,!(i<=e));)r[s+1]=n,a[o+1]=a[o],s-=1,o-=1;r[s+1]=u,a[o+1]=f,t+=1,v+=1}}Uf.exports=iE});var Gf=V(function(_Z,Kf){"use strict";var vE=require("@stdlib/array/base/zero-to"),tE=require("@stdlib/array/base/copy-indexed"),Yf=require("@stdlib/array/base/take"),sE=Ff();function oE(r,a,e){var i;return i=vE(r.length),a=tE(a),sE(a,i),r=Yf(r,i),e=Yf(e,i),{sh:r,sx:a,sy:e}}Kf.exports=oE});var kr=V(function(OZ,Jf){"use strict";var nE=Gf();Jf.exports=nE});var Xf=V(function(TZ,Zf){"use strict";var uE={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};Zf.exports=uE});var Hf=V(function(kZ,Qf){"use strict";var Wf=qe(),zi=Xf();function fE(r,a){var e,i;return e=Wf(r),i=Wf(a),e===null||i===null?zi.BLOCK_SIZE_IN_ELEMENTS:e>i?zi.BLOCK_SIZE_IN_BYTES/e|0:zi.BLOCK_SIZE_IN_BYTES/i|0}Qf.exports=fE});var Ir=V(function(IZ,$f){"use strict";var dE=Hf();$f.exports=dE});var ed=V(function(AZ,rd){"use strict";var lE=kr(),cE=Ir();function yE(r,a){var e,i,t,v,s,o,u,f,n,d,q,E,y,p,h,m,j,T,x,S,w,l,g,c,b;for(b=lE(r.shape,r.strides,a.strides),E=b.sh,h=b.sx,m=b.sy,e=cE(r.dtype,a.dtype),j=r.offset,T=a.offset,i=r.data,t=a.data,o=h[0],f=m[0],v=r.accessors[0],s=a.accessors[1],c=E[1];c>0;)for(c0;)for(g0;)for(k0;)for(R0;)for(N0;)for(M0;)for(P0;)for(L0;)for(C0;)for(J0;)for(Y0;)for(G0;)for(K0;)for(F0;)for(er0;)for(H0;)for($0;)for(X0;)for(Q0;)for(W0;)for(or0;)for(sr0;)for(tr0;)for(ar0;)for(vr0;)for(rr0;)for(ir0;)for(yr0;)for(lr0;)for(cr0;)for(fr0;)for(dr0;)for(ur0;)for(nr0;)for(or0;)for(br0;)for(mr0;)for(qr0;)for(gr0;)for(hr0;)for(xr0;)for(pr0;)for(yr0;)for(lr0;)for(Nr0;)for(Ar0;)for(Tr0;)for(Or0;)for(_r0;)for(Er0;)for(Sr0;)for(br0;)for(mr0;)for(qr0;)for(l0;)for(w0;)for(N0;)for(O0;)for(A0;)for(L0;)for(C0;)for(I0;)for(z0;)for(G0;)for(K0;)for(F0;)for(U0;)for(B0;)for($0;)for(X0;)for(Q0;)for(W0;)for(Z0;)for(J0;)for(tr0;)for(ar0;)for(vr0;)for(rr0;)for(ir0;)for(er0;)for(H0;)for(cr0;)for(fr0;)for(dr0;)for(ur0;)for(nr0;)for(or0;)for(sr0;)for(tr0;)for(qr0;)for(gr0;)for(hr0;)for(xr0;)for(pr0;)for(yr0;)for(lr0;)for(cr0;)for(fr0;)for(Tr0;)for(Or0;)for(_r0;)for(Er0;)for(Sr0;)for(br0;)for(mr0;)for(qr0;)for(gr0;)for(hr=o&&(t=o-1);else if(v==="wrap")t<0?(t+=o,t<0&&(t%=o,t!==0&&(t+=o))):t>=o&&(t-=o,t>=o&&(t%=o));else if(t<0||t>=o)throw new RangeError(w_("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",o,t));if(u=e,i==="column-major"){for(n=0;n=0;n--)f=t%r[n],t-=f,t/=r[n],u+=f*a[n];return u}v0.exports=j_});var ce=V(function(oX,s0){"use strict";var E_=t0();s0.exports=E_});var f0=V(function(nX,u0){"use strict";var __=Cr(),o0=ce(),n0="throw";function O_(r,a){var e,i,t,v,s,o,u,f,n,d,q,E,y,p,h;for(f=r.shape,s=__(f),e=r.data,i=a.data,n=r.strides,d=a.strides,q=r.offset,E=a.offset,t=r.order,v=a.order,o=r.accessors[0],u=a.accessors[1],h=0;h=0&&(n=r[s],i=n<0?-n:n,!(i<=e));)r[s+1]=n,a[o+1]=a[o],s-=1,o-=1;r[s+1]=u,a[o+1]=f,t+=1,v+=1}}Y0.exports=LO});var Z0=V(function(jX,J0){"use strict";var PO=require("@stdlib/array/base/zero-to"),VO=require("@stdlib/array/base/copy-indexed"),La=require("@stdlib/array/base/take"),MO=require("@stdlib/array/base/filled"),Li=Te(),BO=K0(),G0=3;function UO(r,a,e,i){var t,v,s,o,u,f,n,d,q,E;if(t=PO(r.length),f=Li(a),n=Li(e),d=Li(i),v=MO([],4),v[f].push(a),v[n].push(e),v[d].push(i),s=v[0].length,s===G0)u=a;else if(s===G0-1){for(q=1;q<4;q++)if(v[q].length){u=v[q][0];break}}else{for(E=0,q=1;q<4;q++)o=v[q].length,o>=s&&(s=o,E=q);u=v[E][0]}return u=VO(u),BO(u,t),r=La(r,t),a=a===u?u:La(a,t),e=e===u?u:La(e,t),i=i===u?u:La(i,t),{sh:r,sx:a,sy:e,sz:i}}J0.exports=UO});var W0=V(function(EX,X0){"use strict";var FO=Z0();X0.exports=FO});var H0=V(function(_X,Q0){"use strict";var YO={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};Q0.exports=YO});var rl=V(function(OX,$0){"use strict";var Pi=qe(),Pa=H0();function KO(r,a,e){var i,t,v;return i=Pi(r),t=Pi(a),v=Pi(e),i===null||t===null||v===null?Pa.BLOCK_SIZE_IN_ELEMENTS:i>t&&i>v?Pa.BLOCK_SIZE_IN_BYTES/i|0:t>v?Pa.BLOCK_SIZE_IN_BYTES/t|0:Pa.BLOCK_SIZE_IN_BYTES/v|0}$0.exports=KO});var al=V(function(TX,el){"use strict";var GO=rl();el.exports=GO});var tl=V(function(kX,vl){"use strict";var JO=require("@stdlib/string/format"),Va=require("@stdlib/math/base/special/trunc"),il=require("@stdlib/math/base/special/abs");function ZO(r,a,e,i,t,v){var s,o,u,f,n,d;for(s=r.length,o=1,d=0;d=o&&(t=o-1);else if(v==="wrap")t<0?(t+=o,t<0&&(t%=o,t!==0&&(t+=o))):t>=o&&(t-=o,t>=o&&(t%=o));else if(t<0||t>=o)throw new RangeError(JO("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",o,t));if(u=0,i==="column-major"){for(d=s-1;d>=0;d--)n=a[d],n<0?(f=Va(t/n),t-=f*n,f+=r[d]-1):(f=Va(t/n),t-=f*n),u+=f*il(n);return u}for(d=0;d=0;f--)if(n=o-s+f,!(n<0)){if(u=t[n],i=a[f],i!==0&&if&&(f=a[n]);for(n=0;n=0;){for(v=a[0]-f+n,v>=0?i=t[v]:i=1,d=1;d=0?o=r[d][s]:o=1,i===1){i=o;continue}if(!(o===1||i===o))return null}e[n]=i,n-=1}return e}ml.exports=yT});var ql=V(function(CX,gl){"use strict";var pT=xl();gl.exports=pT});var bl=V(function(LX,hl){"use strict";var mT=ia(),xT=ka();function gT(r){var a=xT(r);return a?mT(a):null}hl.exports=gT});var wl=V(function(PX,Sl){"use strict";var qT=bl();Sl.exports=qT});var El=V(function(VX,jl){"use strict";function hT(){return{binary:"r",bool:"x",complex64:"c",complex128:"z",float16:"h",bfloat16:"e",float32:"f",float64:"d",float128:"g",generic:"o",int8:"s",int16:"k",int32:"i",int64:"l",int128:"m",int256:"n",uint8:"b",uint8c:"a",uint16:"t",uint32:"u",uint64:"v",uint128:"w",uint256:"y"}}jl.exports=hT});var Tl=V(function(MX,Ol){"use strict";var bT=ae(),_l=El(),Vi;function ST(r){return arguments.length===0?_l():(Vi===void 0&&(Vi=_l()),Vi[bT(r)]||null)}Ol.exports=ST});var Mi=V(function(BX,kl){"use strict";var wT=Tl();kl.exports=wT});var Rl=V(function(UX,Nl){"use strict";var Il=require("@stdlib/utils/object-inverse"),Al=Mi(),Bi;function jT(r){return arguments.length===0?Il(Al()):(Bi===void 0&&(Bi=Il(Al())),Bi[r]||null)}Nl.exports=jT});var zl=V(function(FX,Dl){"use strict";var ET=Rl();Dl.exports=ET});var Ll=V(function(YX,Cl){"use strict";function _T(){return{binary:"byte",bool:"boolean",complex64:"single-precision floating-point complex number",complex128:"double-precision floating-point complex number",float16:"half-precision floating-point number",bfloat16:"brain floating-point number",float32:"single-precision floating-point number",float64:"double-precision floating-point number",float128:"quadruple-precision floating-point number",generic:"generic array value",int8:"signed 8-bit integer",int16:"signed 16-bit integer",int32:"signed 32-bit integer",int64:"signed 64-bit integer",int128:"signed 128-bit integer",int256:"signed 256-bit integer",uint8:"unsigned 8-bit integer",uint8c:"unsigned 8-bit integer (clamped)",uint16:"unsigned 16-bit integer",uint32:"unsigned 32-bit integer",uint64:"unsigned 64-bit integer",uint128:"unsigned 128-bit integer",uint256:"unsigned 256-bit integer"}}Cl.exports=_T});var Ml=V(function(KX,Vl){"use strict";var OT=ae(),Pl=Ll(),Ui;function TT(r){return arguments.length===0?Pl():(Ui===void 0&&(Ui=Pl()),Ui[OT(r)]||null)}Vl.exports=TT});var Ul=V(function(GX,Bl){"use strict";var kT=Ml();Bl.exports=kT});var Yl=V(function(JX,Fl){"use strict";var IT=ha(),AT=ia();function NT(r){var a=typeof r;return a==="number"?IT(r)?r:null:a==="string"?AT(r):null}Fl.exports=NT});var Fi=V(function(ZX,Kl){"use strict";var RT=Yl();Kl.exports=RT});var Gl=V(function(XX,DT){DT.exports={binary:null,bool:"bool",complex64:"stdlib_complex64_t",complex128:"stdlib_complex128_t",float16:null,bfloat16:null,float32:"float",float64:"double",float128:null,generic:null,int8:"int8_t",int16:"int16_t",int32:"int32_t",int64:"int64_t",int128:null,int256:null,uint8:"uint8_t",uint8c:null,uint16:"uint16_t",uint32:"uint32_t",uint64:"uint64_t",uint128:null,uint256:null}});var Zl=V(function(WX,Jl){"use strict";var zT=ae(),CT=Gl();function LT(r){return CT[zT(r)]||null}Jl.exports=LT});var Wl=V(function(QX,Xl){"use strict";var PT=Zl();Xl.exports=PT});var $l=V(function(HX,Hl){"use strict";var VT=require("@stdlib/assert/is-array-like-object"),Ql=require("@stdlib/assert/is-nonnegative-integer").isPrimitive,MT=ae(),Yi=require("@stdlib/string/format");function BT(r,a,e){var i,t,v,s,o,u,f,n;if(!VT(r))throw new TypeError(Yi("invalid argument. First argument must be an array-like object. Value: `%s`.",r));if(!Ql(a))throw new TypeError(Yi("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",a));if(!Ql(e))throw new TypeError(Yi("invalid argument. Third argument must be a nonnegative integer. Value: `%s`.",e));if(i=r.length,i===0)throw new RangeError("invalid argument. First argument must contain at least one element.");if(o=a+e,i%o!==0)throw new RangeError("invalid arguments. Length of the first argument is incompatible with the second and third arguments.");for(t=[],v=[],u=2*o,n=2*a,f=0;f<=u;f++)f===0?f===n?v.push("() => ("):v.push("("):f===u?f===n?v.push(") => ()"):v.push(")"):f===n?v.push(") => ("):f%2===1?v.push(""):v.push(", ");for(f=0;f0?(v=GT(a),s=FT(a,e)):(v=1,s=[0]),r==="binary"?t=ZT(v):t=JT(v,r),new KT(r,t,a,s,YT(a,s),e)}e1.exports=XT});var v1=V(function(eW,i1){"use strict";var WT=a1();i1.exports=WT});var s1=V(function(aW,t1){"use strict";var QT=Yr(),HT=Gr(),$T=Cr(),rk=Zr(),ek=Kr(),ak=Xr(),ik=require("@stdlib/array/empty"),vk=require("@stdlib/buffer/alloc-unsafe");function tk(r){var a,e,i,t,v,s,o;return o=rk(r),v=ek(r,!0),t=ak(r),a=v.length,a>0?(e=$T(v),s=QT(v,t)):(e=1,s=[0]),o==="binary"?i=vk(e):i=ik(e,o),new r.constructor(o,i,v,s,HT(v,s),t)}t1.exports=tk});var n1=V(function(iW,o1){"use strict";var sk=s1();o1.exports=sk});var y1=V(function(vW,c1){"use strict";var ok=je(),u1=Zr(),nk=Kr(),uk=se(),f1=le(),fk=Xr(),d1=me(),l1=require("@stdlib/string/format");function dk(r,a){var e,i,t,v,s,o,u;if(v=nk(r,!1),s=uk(r,!1),t=fk(r),o=v.length,e=[],i=[],a<0){if(a<-o-1)throw new RangeError(l1("invalid argument. Specified axis is out-of-bounds. Must be on the interval: [-%u-1, %u]. Value: `%d`.",o,o,a));a+=o+1}else if(a>o)throw new RangeError(l1("invalid argument. Specified axis is out-of-bounds. Must be on the interval: [-%u-1, %u]. Value: `%d`.",o,o,a));if(a===0)for(i.push(1),e.push(s[0]),u=0;u0&&(q=qk(q.length))}else q=j1(E);return E1(q)===0?Ok(d,s,Gi(q,f),u,!i):(v=Ek(E,t,v),q=Gi(q,f),q.length===0?new d(s,Ji(r),[],[0],v,u,{readonly:!i}):(t=_k(E,t,f),new d(s,Ji(r),q,t,v,u,{readonly:!i})))}O1.exports=Tk});var oe=V(function(fW,k1){"use strict";var kk=T1();k1.exports=kk});var A1=V(function(dW,I1){"use strict";function Ik(r){var a=r.ndims;return typeof a=="number"?a:r.shape.length}I1.exports=Ik});var Fe=V(function(lW,N1){"use strict";var Ak=A1();N1.exports=Ak});var D1=V(function(cW,R1){"use strict";var Nk=require("@stdlib/slice/base/args2multislice"),Rk=require("@stdlib/slice/ctor"),Dk=oe(),zk=require("@stdlib/array/base/filled"),Ck=Fe(),Zi=require("@stdlib/string/format");function Lk(r,a,e){var i,t,v;if(t=Ck(r),t===0)throw new TypeError(Zi("invalid argument. First argument must be an ndarray having one or more dimensions. Number of dimensions: %d.",t));if(v=a,v<0){if(v+=t,v<0)throw new RangeError(Zi("invalid argument. Dimension index exceeds the number of dimensions. Number of dimensions: %d. Value: `%d`.",t,a))}else if(v>=t)throw new RangeError(Zi("invalid argument. Dimension index exceeds the number of dimensions. Number of dimensions: %d. Value: `%d`.",t,a));return i=zk(null,t),i[v]=new Rk(null,null,-1),Dk(r,Nk(i),!0,e)}R1.exports=Lk});var Xi=V(function(yW,z1){"use strict";var Pk=D1();z1.exports=Pk});var L1=V(function(pW,C1){"use strict";var Vk=require("@stdlib/slice/multi"),Mk=Xi(),Bk=oe(),Uk=Fe();function Fk(r,a){return Uk(r)===0?Bk(r,new Vk,!0,a):Mk(r,-1,a)}C1.exports=Fk});var V1=V(function(mW,P1){"use strict";var Yk=L1();P1.exports=Yk});var B1=V(function(xW,M1){"use strict";var Kk=require("@stdlib/array/base/assert/is-accessor-array"),Gk=require("@stdlib/array/base/accessor-setter"),Jk=require("@stdlib/array/base/setter"),Zk=ie(),Xk=ee(),Wk=require("@stdlib/string/format");function Qk(r,a,e){var i,t;if(i=Zk(a,1),i===null)throw new TypeError(Wk("invalid argument. Second argument must be a recognized data type. Value: `%s`.",a));return/^complex/.test(a)&&typeof r=="number"&&(r=[r,0]),Kk(i)?t=Gk(a):t=Jk(a),t(i,0,r),new Xk(a,i,[],[0],0,e)}M1.exports=Qk});var F1=V(function(gW,U1){"use strict";var Hk=B1();U1.exports=Hk});var Wi=V(function(qW,Y1){"use strict";var $k=require("@stdlib/string/format"),Ba=require("@stdlib/math/base/special/trunc");function rI(r,a,e,i,t,v,s){var o,u,f,n,d;for(o=r.length,u=1,d=0;d=u&&(t=u-1);else if(v==="wrap")t<0?(t+=u,t<0&&(t%=u,t!==0&&(t+=u))):t>=u&&(t-=u,t>=u&&(t%=u));else if(t<0||t>=u)throw new RangeError($k("invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.",u,t));if(e===0){if(i==="column-major"){for(d=0;d=0;d--)n=t%r[d],t-=n,t/=r[d],s[d]=n;return s}if(i==="column-major"){for(d=o-1;d>=0;d--)n=a[d],n<0?(f=Ba(t/n),t-=f*n,s[d]=r[d]-1+f):(f=Ba(t/n),t-=f*n,s[d]=f);return s}for(d=0;d0&&(t+=a[v]*(r[v]-1))}return t}X1.exports=tI});var H1=V(function(wW,Q1){"use strict";var sI=W1();Q1.exports=sI});var ec=V(function(jW,rc){"use strict";var $1=Ma(),oI=Kr();function nI(r,a){var e,i,t;if(i=a.length,e=oI(r,!1),e.length===i){for(t=0;ti;v--)t[v]=e[v];for(v=i;v>=0&&(s=(e[v]+1)%a[v],t[v]=s,!(s>0));v--);for(v-=1;v>=0;v--)t[v]=e[v];return t}function gI(r,a,e,i,t){var v,s;for(v=0;v0));v++);for(v+=1;v=v)return null;return a===mI?xI(v,r,e,i,t):gI(v,r,e,i,t)}lc.exports=qI});var yc=V(function(AW,cc){"use strict";var hI=require("@stdlib/array/base/zeros"),bI=Hi();function SI(r,a,e,i){return bI(r,a,e,i,hI(r.length))}cc.exports=SI});var Ne=V(function(NW,mc){"use strict";var wI=require("@stdlib/utils/define-nonenumerable-read-only-property"),pc=yc(),jI=Hi();wI(pc,"assign",jI);mc.exports=pc});var gc=V(function(RW,xc){"use strict";function EI(r){var a,e;for(a=0,e=0;e=0&&(n=r[s],i=n<0?-n:n,!(i<=e));)r[s+1]=n,a[o+1]=a[o],s-=1,o-=1;r[s+1]=u,a[o+1]=f,t+=1,v+=1}}bc.exports=OI});var jc=V(function(CW,wc){"use strict";var TI=require("@stdlib/array/base/zero-to"),kI=require("@stdlib/array/base/copy-indexed"),II=require("@stdlib/array/base/take"),AI=Sc();function NI(r,a){var e;return e=TI(r.length),a=kI(a),AI(a,e),r=II(r,e),{sh:r,sx:a}}wc.exports=NI});var Mr=V(function(LW,Ec){"use strict";var RI=jc();Ec.exports=RI});var Oc=V(function(PW,_c){"use strict";var DI={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};_c.exports=DI});var Ic=V(function(VW,kc){"use strict";var zI=qe(),Tc=Oc();function CI(r){var a=zI(r);return a===null?Tc.BLOCK_SIZE_IN_ELEMENTS:Tc.BLOCK_SIZE_IN_BYTES/a|0}kc.exports=CI});var Br=V(function(MW,Ac){"use strict";var LI=Ic();Ac.exports=LI});var Rc=V(function(BW,Nc){"use strict";var PI=Mr(),VI=Br();function MI(r,a){var e,i,t,v,s,o,u,f,n,d,q,E,y,p,h,m,j;for(j=PI(r.shape,r.strides),u=j.sh,d=j.sx,e=VI(r.dtype),q=r.offset,i=r.data,v=d[0],t=r.accessors[1],m=u[1];m>0;)for(m0;)for(h0;)for(w0;)for(S0;)for(x0;)for(_0;)for(b0;)for(c0;)for(g0;)for(k0;)for(R0;)for(N0;)for(O0;)for(A0;)for(L0;)for(C0;)for(I0;)for(z0;)for(D0;)for(k0;)for(F0;)for(U0;)for(B0;)for(M0;)for(P0;)for(L0;)for(C0;)for(Z0;)for(J0;)for(Y0;)for(G0;)for(K0;)for(F0;)for(U0;)for(B0;)for(H0;)for($0;)for(X0;)for(Q0;)for(W0;)for(Z0;)for(J0;)for(Y0;)for(G0;)for(ar0;)for(vr0;)for(rr0;)for(ir0;)for(er0;)for(H0;)for($0;)for(X0;)for(Q0;)for(W0;)for(h0;)for(p0;)for(S0;)for(x0;)for(T0;)for(b0;)for(c0;)for(g0;)for(l0;)for(R0;)for(N0;)for(O0;)for(A0;)for(_0;)for(C0;)for(I0;)for(z0;)for(D0;)for(k0;)for(R0;)for(U0;)for(B0;)for(M