diff --git a/lib/node_modules/@stdlib/ndarray/transpose/README.md b/lib/node_modules/@stdlib/ndarray/transpose/README.md
new file mode 100644
index 000000000000..5683e4b92b13
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/README.md
@@ -0,0 +1,130 @@
+
+
+# transpose
+
+> Return a **read-only** view of an input [`ndarray`][@stdlib/ndarray/ctor] in which the last two dimensions are transposed.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var transpose = require( '@stdlib/ndarray/transpose' );
+```
+
+#### transpose( x )
+
+Returns a read-only view of an input [`ndarray`][@stdlib/ndarray/ctor] in which the last two dimensions are transposed.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ] );
+// returns [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]
+
+var y = transpose( x );
+// returns [ [ 1.0, 4.0 ], [ 2.0, 5.0 ], [ 3.0, 6.0 ] ]
+```
+
+The function accepts the following arguments:
+
+- **x**: input [`ndarray`][@stdlib/ndarray/ctor].
+
+
+
+
+
+
+
+
+
+## Notes
+
+- The function operates on a stack of matrices, transposing the last two dimensions of the input ndarray.
+- The input ndarray must have at least two dimensions.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var uniform = require( '@stdlib/random/uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var transpose = require( '@stdlib/ndarray/transpose' );
+
+var x = uniform( [ 2, 3, 4 ], -10.0, 10.0 );
+console.log( ndarray2array( x ) );
+
+var y = transpose( x );
+console.log( ndarray2array( y ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/transpose/benchmark/benchmark.js
new file mode 100644
index 000000000000..0bf9b9fcd288
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/benchmark/benchmark.js
@@ -0,0 +1,159 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 empty = require( '@stdlib/ndarray/empty' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var transpose = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s:ndims=2', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
+
+ 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, stdlib/line-closing-bracket-spacing */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = transpose( 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( format( '%s:ndims=3', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
+
+ 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, stdlib/line-closing-bracket-spacing */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = transpose( 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( format( '%s:ndims=4', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
+
+ 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, stdlib/line-closing-bracket-spacing */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = transpose( 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( format( '%s:ndims=5', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ /* eslint-disable object-curly-newline, stdlib/line-closing-bracket-spacing */
+
+ 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, stdlib/line-closing-bracket-spacing */
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = transpose( 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/lib/node_modules/@stdlib/ndarray/transpose/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/transpose/docs/repl.txt
new file mode 100644
index 000000000000..f38c2c89a723
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/docs/repl.txt
@@ -0,0 +1,30 @@
+
+{{alias}}( x )
+ Returns a read-only view of an input ndarray in which the last two
+ dimensions are transposed.
+
+ The function operates on a stack of matrices, transposing the last two
+ dimensions of the input ndarray.
+
+ The input ndarray must have at least two dimensions.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ Returns
+ -------
+ out: ndarray
+ Output array view.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] )
+ [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
+ > var y = {{alias}}( x )
+ [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/transpose/docs/types/index.d.ts
new file mode 100644
index 000000000000..ea924c23bee9
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/docs/types/index.d.ts
@@ -0,0 +1,50 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 read-only view of an input ndarray in which the last two dimensions are transposed.
+*
+* ## Notes
+*
+* - The function operates on a stack of matrices, transposing the last two dimensions of the input ndarray.
+* - The input ndarray must have at least two dimensions.
+*
+* @param x - input array
+* @returns output array
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ] );
+* // returns [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]
+*
+* var y = transpose( x );
+* // returns [ [ 1.0, 4.0 ], [ 2.0, 5.0 ], [ 3.0, 6.0 ] ]
+*/
+declare function transpose( x: T ): T;
+
+
+// EXPORTS //
+
+export = transpose;
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/transpose/docs/types/test.ts
new file mode 100644
index 000000000000..bc161b4b7e6f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/docs/types/test.ts
@@ -0,0 +1,52 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 space-in-parens */
+
+import zeros = require( '@stdlib/ndarray/zeros' );
+import transpose = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ transpose( zeros( [ 2, 2 ] ) ); // $ExpectType float64ndarray
+ transpose( zeros( [ 2, 2 ], { 'dtype': 'float32' } ) ); // $ExpectType float32ndarray
+ transpose( zeros( [ 2, 2 ], { 'dtype': 'int32' } ) ); // $ExpectType int32ndarray
+ transpose( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ) ); // $ExpectType complex128ndarray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ transpose( '10' ); // $ExpectError
+ transpose( 10 ); // $ExpectError
+ transpose( false ); // $ExpectError
+ transpose( true ); // $ExpectError
+ transpose( null ); // $ExpectError
+ transpose( void 0 ); // $ExpectError
+ transpose( [] ); // $ExpectError
+ transpose( {} ); // $ExpectError
+ transpose( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ transpose(); // $ExpectError
+ transpose( zeros( [ 2, 2 ] ), {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/examples/index.js b/lib/node_modules/@stdlib/ndarray/transpose/examples/index.js
new file mode 100644
index 000000000000..26737e925aeb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/examples/index.js
@@ -0,0 +1,29 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 uniform = require( '@stdlib/random/uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var transpose = require( './../lib' );
+
+var x = uniform( [ 2, 3, 4 ], -10.0, 10.0 );
+console.log( ndarray2array( x ) );
+
+var y = transpose( x );
+console.log( ndarray2array( y ) );
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/lib/index.js b/lib/node_modules/@stdlib/ndarray/transpose/lib/index.js
new file mode 100644
index 000000000000..02a8d9cfc8f4
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/lib/index.js
@@ -0,0 +1,44 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 read-only view of an input ndarray in which the last two dimensions are transposed.
+*
+* @module @stdlib/ndarray/transpose
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+* var transpose = require( '@stdlib/ndarray/transpose' );
+*
+* var x = array( [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ] );
+* // returns [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]
+*
+* var y = transpose( x );
+* // returns [ [ 1.0, 4.0 ], [ 2.0, 5.0 ], [ 3.0, 6.0 ] ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/lib/main.js b/lib/node_modules/@stdlib/ndarray/transpose/lib/main.js
new file mode 100644
index 000000000000..8e4cf665cf9f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/lib/main.js
@@ -0,0 +1,66 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var base = require( '@stdlib/ndarray/base/transpose' );
+var ndims = require( '@stdlib/ndarray/base/ndims' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Returns a read-only view of an input ndarray in which the last two dimensions are transposed.
+*
+* ## Notes
+*
+* - The function operates on a stack of matrices, transposing the last two dimensions of the input ndarray.
+* - The input ndarray must have at least two dimensions.
+*
+* @param {ndarray} x - input array
+* @throws {TypeError} must provide an ndarray
+* @throws {RangeError} input ndarray must have at least two dimensions
+* @returns {ndarray} ndarray view
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ] );
+* // returns [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]
+*
+* var y = transpose( x );
+* // returns [ [ 1.0, 4.0 ], [ 2.0, 5.0 ], [ 3.0, 6.0 ] ]
+*/
+function transpose( x ) {
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
+ }
+ if ( ndims( x ) < 2 ) {
+ throw new RangeError( format( 'invalid argument. Input ndarray must have at least two dimensions. Number of dimensions: `%u`.', ndims( x ) ) );
+ }
+ return base( x, false );
+}
+
+
+// EXPORTS //
+
+module.exports = transpose;
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/package.json b/lib/node_modules/@stdlib/ndarray/transpose/package.json
new file mode 100644
index 000000000000..66a431e0c0c5
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/ndarray/transpose",
+ "version": "0.0.0",
+ "description": "Return a read-only view of an input ndarray in which the last two dimensions are transposed.",
+ "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",
+ "data",
+ "structure",
+ "ndarray",
+ "matrix",
+ "view",
+ "transpose",
+ "stack",
+ "permute",
+ "swap",
+ "swapaxes"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ndarray/transpose/test/test.js b/lib/node_modules/@stdlib/ndarray/transpose/test/test.js
new file mode 100644
index 000000000000..f49530a61d80
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/transpose/test/test.js
@@ -0,0 +1,328 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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( '@stdlib/ndarray/base/assert/is-read-only' );
+var isEqualDataType = require( '@stdlib/ndarray/base/assert/is-equal-data-type' );
+var zeroTo = require( '@stdlib/array/zero-to' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var array = require( '@stdlib/ndarray/array' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var transpose = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof transpose, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ transpose( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an input ndarray having fewer than two dimensions', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ scalar2ndarray( 5.0 ),
+ array( [ 1.0, 2.0, 3.0 ] )
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided an ndarray having ' + values[ i ].ndims + ' dimensions' );
+ }
+ t.end();
+
+ function badValue( x ) {
+ return function badValue() {
+ transpose( x );
+ };
+ }
+});
+
+tape( 'the function returns a read-only view of an input ndarray in which the last two dimensions are transposed (ndims=2)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 6, 'float64' );
+ sh = [ 2, 3 ];
+ st = [ 3, 1 ];
+ o = 0;
+ ord = 'row-major';
+
+ x = new ndarray( 'float64', buf, sh, st, o, ord );
+
+ actual = transpose( x );
+ expected = [
+ [ 0, 3 ],
+ [ 1, 4 ],
+ [ 2, 5 ]
+ ];
+
+ t.notEqual( actual, x, 'returns expected value' );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a read-only view of an input ndarray in which the last two dimensions are transposed (ndims=3)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 12, 'float64' );
+ sh = [ 2, 2, 3 ];
+ st = [ 6, 3, 1 ];
+ o = 0;
+ ord = 'row-major';
+
+ x = new ndarray( 'float64', buf, sh, st, o, ord );
+
+ actual = transpose( x );
+ expected = [
+ [
+ [ 0, 3 ],
+ [ 1, 4 ],
+ [ 2, 5 ]
+ ],
+ [
+ [ 6, 9 ],
+ [ 7, 10 ],
+ [ 8, 11 ]
+ ]
+ ];
+
+ t.notEqual( actual, x, 'returns expected value' );
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a read-only view of an input ndarray in which the last two dimensions are transposed (ndims=4)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 24, 'float64' );
+ sh = [ 2, 2, 2, 3 ];
+ st = [ 12, 6, 3, 1 ];
+ o = 0;
+ ord = 'row-major';
+
+ x = new ndarray( 'float64', buf, sh, st, o, ord );
+
+ actual = transpose( x );
+ expected = [
+ [
+ [
+ [ 0, 3 ],
+ [ 1, 4 ],
+ [ 2, 5 ]
+ ],
+ [
+ [ 6, 9 ],
+ [ 7, 10 ],
+ [ 8, 11 ]
+ ]
+ ],
+ [
+ [
+ [ 12, 15 ],
+ [ 13, 16 ],
+ [ 14, 17 ]
+ ],
+ [
+ [ 18, 21 ],
+ [ 19, 22 ],
+ [ 20, 23 ]
+ ]
+ ]
+ ];
+
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 2, 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports column-major input arrays', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 6, 'float64' );
+ sh = [ 2, 3 ];
+ st = [ 1, 2 ];
+ o = 0;
+ ord = 'column-major';
+
+ x = new ndarray( 'float64', buf, sh, st, o, ord );
+
+ // In column-major with strides [ 1, 2 ], x = [ [ 0, 2, 4 ], [ 1, 3, 5 ] ]:
+ actual = transpose( x );
+ expected = [
+ [ 0, 1 ],
+ [ 2, 3 ],
+ [ 4, 5 ]
+ ];
+
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function preserves the input data type (dtype=int32)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 6, 'int32' );
+ sh = [ 2, 3 ];
+ st = [ 3, 1 ];
+ o = 0;
+ ord = 'row-major';
+
+ x = new ndarray( 'int32', buf, sh, st, o, ord );
+
+ actual = transpose( x );
+ expected = [
+ [ 0, 3 ],
+ [ 1, 4 ],
+ [ 2, 5 ]
+ ];
+
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function preserves the input array offset', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+ var ord;
+ var sh;
+ var st;
+ var o;
+ var x;
+
+ buf = zeroTo( 12, 'float64' );
+ sh = [ 2, 3 ];
+ st = [ 3, 1 ];
+ o = 6;
+ ord = 'row-major';
+
+ x = new ndarray( 'float64', buf, sh, st, o, ord );
+
+ actual = transpose( x );
+ expected = [
+ [ 6, 9 ],
+ [ 7, 10 ],
+ [ 8, 11 ]
+ ];
+
+ t.strictEqual( isReadOnly( actual ), true, 'returns expected value' );
+ t.strictEqual( getData( actual ), getData( x ), 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 3, 2 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});