diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/README.md b/lib/node_modules/@stdlib/ndarray/to-transposed/README.md
new file mode 100644
index 000000000000..cfbd27ce49c1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/README.md
@@ -0,0 +1,132 @@
+
+
+# toTransposed
+
+> Return a new [`ndarray`][@stdlib/ndarray/ctor] containing the elements of an input [`ndarray`][@stdlib/ndarray/ctor] but whose last two dimensions are transposed.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var toTransposed = require( '@stdlib/ndarray/to-transposed' );
+```
+
+#### toTransposed( x )
+
+Returns a new [`ndarray`][@stdlib/ndarray/ctor] containing the elements of an input [`ndarray`][@stdlib/ndarray/ctor] but whose last two dimensions are transposed.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
+// returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
+
+var y = toTransposed( x );
+// returns [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
+```
+
+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 array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var toTransposed = require( '@stdlib/ndarray/to-transposed' );
+
+var x = array( [ [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], [ [ 7, 8, 9 ], [ 10, 11, 12 ] ] ] );
+console.log( ndarray2array( x ) );
+
+var y = toTransposed( 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/to-transposed/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/to-transposed/benchmark/benchmark.js
new file mode 100644
index 000000000000..317901ea4b1a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/benchmark/benchmark.js
@@ -0,0 +1,173 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var ndarrayBase = require( '@stdlib/ndarray/base/ctor' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var toTransposed = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s:ctor=base,ndims=2', pkg ), function benchmark( b ) {
+ var strides;
+ var buffer;
+ var offset;
+ var dtype;
+ var order;
+ var shape;
+ var out;
+ var i;
+ var x;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 24 );
+ shape = [ 4, 6 ];
+ strides = [ 6, 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ x = ndarrayBase( dtype, buffer, shape, strides, offset, order );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = toTransposed( x );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( out ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s:ctor=ndarray,ndims=2', pkg ), function benchmark( b ) {
+ var strides;
+ var buffer;
+ var offset;
+ var dtype;
+ var order;
+ var shape;
+ var out;
+ var i;
+ var x;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 24 );
+ shape = [ 4, 6 ];
+ strides = [ 6, 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ x = ndarray( dtype, buffer, shape, strides, offset, order );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = toTransposed( x );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( out ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s:ctor=base,ndims=3', pkg ), function benchmark( b ) {
+ var strides;
+ var buffer;
+ var offset;
+ var dtype;
+ var order;
+ var shape;
+ var out;
+ var i;
+ var x;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 24 );
+ shape = [ 2, 4, 3 ];
+ strides = [ 12, 3, 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ x = ndarrayBase( dtype, buffer, shape, strides, offset, order );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = toTransposed( x );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( out ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s:ctor=ndarray,ndims=3', pkg ), function benchmark( b ) {
+ var strides;
+ var buffer;
+ var offset;
+ var dtype;
+ var order;
+ var shape;
+ var out;
+ var i;
+ var x;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 24 );
+ shape = [ 2, 4, 3 ];
+ strides = [ 12, 3, 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ x = ndarray( dtype, buffer, shape, strides, offset, order );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = toTransposed( x );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( out ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/to-transposed/docs/repl.txt
new file mode 100644
index 000000000000..6646f269c237
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/docs/repl.txt
@@ -0,0 +1,29 @@
+
+{{alias}}( x )
+ Returns a new ndarray containing the elements of an input ndarray but whose
+ 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.
+
+ 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/to-transposed/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/to-transposed/docs/types/index.d.ts
new file mode 100644
index 000000000000..17a735ffabfc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/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 new ndarray containing the elements of an input ndarray but whose 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 ndarray
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
+* // returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
+*
+* var y = toTransposed( x );
+* // returns [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
+*/
+declare function toTransposed( x: T ): T;
+
+
+// EXPORTS //
+
+export = toTransposed;
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/to-transposed/docs/types/test.ts
new file mode 100644
index 000000000000..977dee2d20ed
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/docs/types/test.ts
@@ -0,0 +1,54 @@
+/*
+* @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 toTransposed = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const x = zeros( [ 2, 3 ], {
+ 'dtype': 'float64'
+ });
+
+ toTransposed( x ); // $ExpectType float64ndarray
+}
+
+// The compiler throws an error if the function is not provided a first argument which is an ndarray...
+{
+ toTransposed( true ); // $ExpectError
+ toTransposed( false ); // $ExpectError
+ toTransposed( null ); // $ExpectError
+ toTransposed( undefined ); // $ExpectError
+ toTransposed( '5' ); // $ExpectError
+ toTransposed( [ '1', '2' ] ); // $ExpectError
+ toTransposed( {} ); // $ExpectError
+ toTransposed( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 3 ] );
+
+ toTransposed(); // $ExpectError
+ toTransposed( x, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/examples/index.js b/lib/node_modules/@stdlib/ndarray/to-transposed/examples/index.js
new file mode 100644
index 000000000000..2d71af37dd7f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/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 array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var toTransposed = require( './../lib' );
+
+var x = array( [ [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], [ [ 7, 8, 9 ], [ 10, 11, 12 ] ] ] );
+console.log( ndarray2array( x ) );
+
+var y = toTransposed( x );
+console.log( ndarray2array( y ) );
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/lib/index.js b/lib/node_modules/@stdlib/ndarray/to-transposed/lib/index.js
new file mode 100644
index 000000000000..56591282a4cc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/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 new ndarray containing the elements of an input ndarray but whose last two dimensions are transposed.
+*
+* @module @stdlib/ndarray/to-transposed
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+* var toTransposed = require( '@stdlib/ndarray/to-transposed' );
+*
+* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
+* // returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
+*
+* var y = toTransposed( x );
+* // returns [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/lib/main.js b/lib/node_modules/@stdlib/ndarray/to-transposed/lib/main.js
new file mode 100644
index 000000000000..c74385e3be57
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/lib/main.js
@@ -0,0 +1,76 @@
+/**
+* @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 ndims = require( '@stdlib/ndarray/base/ndims' );
+var ndarraylike2ndarray = require( '@stdlib/ndarray/base/ndarraylike2ndarray' );
+var transpose = require( '@stdlib/ndarray/base/transpose' );
+var emptyLike = require( '@stdlib/ndarray/empty-like' );
+var assign = require( '@stdlib/ndarray/base/assign' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Returns a new ndarray containing the elements of an input ndarray but whose 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} must provide an ndarray having two or more dimensions
+* @returns {ndarray} output ndarray
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
+* // returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
+*
+* var y = toTransposed( x );
+* // returns [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
+*/
+function toTransposed( x ) {
+ var out;
+ var bv;
+
+ 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. Must provide an ndarray having two or more dimensions. Number of dimensions: `%u`.', ndims( x ) ) );
+ }
+ bv = ndarraylike2ndarray( x );
+ bv = transpose( bv, false );
+ out = emptyLike( bv );
+ assign( [ bv, out ] );
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = toTransposed;
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/package.json b/lib/node_modules/@stdlib/ndarray/to-transposed/package.json
new file mode 100644
index 000000000000..e9a915439e50
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/package.json
@@ -0,0 +1,74 @@
+{
+ "name": "@stdlib/ndarray/to-transposed",
+ "version": "0.0.0",
+ "description": "Return a new ndarray containing the elements of an input ndarray but whose 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",
+ "transpose",
+ "transposed",
+ "to-transposed",
+ "stack",
+ "permute",
+ "swap",
+ "swapaxes",
+ "dimension",
+ "multidimensional",
+ "array",
+ "utilities",
+ "utility",
+ "utils",
+ "util"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ndarray/to-transposed/test/test.js b/lib/node_modules/@stdlib/ndarray/to-transposed/test/test.js
new file mode 100644
index 000000000000..b3976dcb1e01
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-transposed/test/test.js
@@ -0,0 +1,179 @@
+/**
+* @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 isEqualDataType = require( '@stdlib/ndarray/base/assert/is-equal-data-type' );
+var zeroTo = require( '@stdlib/blas/ext/zero-to' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var toTransposed = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof toTransposed, '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() {
+ toTransposed( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) {
+ var values;
+ var opts;
+ var i;
+
+ opts = {
+ 'dtype': 'float64'
+ };
+
+ values = [
+ zeros( [], opts ),
+ zeros( [ 6 ], opts )
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ toTransposed( value );
+ };
+ }
+});
+
+tape( 'the function returns a new ndarray containing the elements of an input ndarray but whose last two dimensions are transposed (2D)', function test( t ) {
+ var expected;
+ var opts;
+ var x;
+ var y;
+
+ opts = {
+ 'dtype': 'generic',
+ 'dims': [ 0, 1 ]
+ };
+ x = zeroTo( [ 2, 3 ], opts );
+
+ expected = [
+ [ 0, 3 ],
+ [ 1, 4 ],
+ [ 2, 5 ]
+ ];
+
+ y = toTransposed( x );
+
+ t.deepEqual( getShape( y ), [ 3, 2 ], 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( y ), getDType( x ) ), true, 'returns expected value' );
+ t.notEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( y ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a new ndarray containing the elements of an input ndarray but whose last two dimensions are transposed (stack of matrices)', function test( t ) {
+ var expected;
+ var opts;
+ var x;
+ var y;
+
+ opts = {
+ 'dtype': 'generic',
+ 'dims': [ 0, 1, 2 ]
+ };
+ x = zeroTo( [ 2, 2, 3 ], opts );
+
+ expected = [
+ [ [ 0, 3 ], [ 1, 4 ], [ 2, 5 ] ],
+ [ [ 6, 9 ], [ 7, 10 ], [ 8, 11 ] ]
+ ];
+
+ y = toTransposed( x );
+
+ t.deepEqual( getShape( y ), [ 2, 3, 2 ], 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( y ), getDType( x ) ), true, 'returns expected value' );
+ t.notEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( y ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports column-major order', function test( t ) {
+ var expected;
+ var opts;
+ var x;
+ var y;
+
+ opts = {
+ 'dtype': 'generic',
+ 'order': 'column-major',
+ 'dims': [ 0, 1 ]
+ };
+ x = zeroTo( [ 2, 3 ], opts );
+
+ expected = [
+ [ 0, 1 ],
+ [ 2, 3 ],
+ [ 4, 5 ]
+ ];
+
+ y = toTransposed( x );
+
+ t.deepEqual( getShape( y ), [ 3, 2 ], 'returns expected value' );
+ t.strictEqual( isEqualDataType( getDType( y ), getDType( x ) ), true, 'returns expected value' );
+ t.notEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( y ), expected, 'returns expected value' );
+
+ t.end();
+});