diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/README.md b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/README.md
new file mode 100644
index 000000000000..85526fab375c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/README.md
@@ -0,0 +1,146 @@
+
+
+# insertDimension
+
+> Insert a new dimension of size one at a specified dimension index of an input ndarray.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var insertDimension = require( '@stdlib/ndarray/base/insert-dimension' );
+```
+
+#### insertDimension( x, dim, writable )
+
+Inserts a new dimension of size one at a specified dimension index of an input ndarray.
+
+```javascript
+var getShape = require( '@stdlib/ndarray/shape' );
+var array = require( '@stdlib/ndarray/array' );
+
+// Create a 2x2 ndarray:
+var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+// returns [ [ 1, 2 ], [ 3, 4 ] ]
+
+// Prepend a singleton dimension:
+var y = insertDimension( x, 0, false );
+// returns [ [ [ 1, 2 ], [ 3, 4 ] ] ]
+
+var sh = getShape( y );
+// returns [ 1, 2, 2 ]
+
+// Append a singleton dimension:
+y = insertDimension( x, 2, false );
+// returns [ [ [ 1 ], [ 2 ] ], [ [ 3 ], [ 4 ] ] ]
+
+sh = getShape( y );
+// returns [ 2, 2, 1 ]
+
+// Insert a singleton dimension:
+y = insertDimension( x, 1, false );
+// returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
+
+sh = getShape( y );
+// returns [ 2, 1, 2 ]
+```
+
+The function accepts the following arguments:
+
+- **x**: input ndarray.
+- **dim**: dimension index at which to insert a singleton dimension.
+- **writable**: boolean indicating whether a returned ndarray should be writable.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A provided dimension index must reside on the interval `[-N-1, N]`, where `N` is the rank (i.e., number of dimensions) of the provided input array. If provided a negative dimension index, the position at which to insert a singleton dimension is computed as `N + dim + 1`. Hence, if provided `-1`, the resolved position is `N` (i.e., a singleton dimension is appended to the input array).
+- The `writable` parameter **only** applies to ndarray constructors supporting **read-only** instances.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var uniform = require( '@stdlib/random/uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var insertDimension = require( '@stdlib/ndarray/base/insert-dimension' );
+
+var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
+console.log( ndarray2array( x ) );
+
+var y = insertDimension( x, 1, false );
+console.log( ndarray2array( y ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/benchmark/benchmark.js
new file mode 100644
index 000000000000..48bc45a57a84
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/benchmark/benchmark.js
@@ -0,0 +1,115 @@
+/**
+* @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 insertDimension = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s::base_ndarray,2d', pkg ), function benchmark( b ) {
+ var strides;
+ var values;
+ var buffer;
+ var offset;
+ var dtype;
+ var shape;
+ var order;
+ var out;
+ var i;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 2 );
+ shape = [ 2 ];
+ strides = [ 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ values = [
+ ndarrayBase( dtype, buffer, shape, strides, offset, order ),
+ ndarrayBase( dtype, buffer, shape, strides, offset, order ),
+ ndarrayBase( dtype, buffer, shape, strides, offset, order ),
+ ndarrayBase( dtype, buffer, shape, strides, offset, order ),
+ ndarrayBase( dtype, buffer, shape, strides, offset, order )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = insertDimension( values[ i%values.length ], 1, false );
+ 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::ndarray,2d', pkg ), function benchmark( b ) {
+ var strides;
+ var values;
+ var buffer;
+ var offset;
+ var dtype;
+ var shape;
+ var order;
+ var out;
+ var i;
+
+ dtype = 'float64';
+ buffer = new Float64Array( 2 );
+ shape = [ 2 ];
+ strides = [ 1 ];
+ offset = 0;
+ order = 'row-major';
+
+ values = [
+ ndarray( dtype, buffer, shape, strides, offset, order ),
+ ndarray( dtype, buffer, shape, strides, offset, order ),
+ ndarray( dtype, buffer, shape, strides, offset, order ),
+ ndarray( dtype, buffer, shape, strides, offset, order ),
+ ndarray( dtype, buffer, shape, strides, offset, order )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = insertDimension( values[ i%values.length ], 1, false );
+ 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/base/insert-dimension/benchmark/benchmark.ndims.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/benchmark/benchmark.ndims.js
new file mode 100644
index 000000000000..90583ba910cb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/benchmark/benchmark.ndims.js
@@ -0,0 +1,95 @@
+/**
+* @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 array = require( '@stdlib/ndarray/array' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var insertDimension = require( './../lib' );
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} ndims - number of dimensions
+* @returns {Function} benchmark function
+*/
+function createBenchmark( ndims ) {
+ var x = array( [ 1, 2, 3, 4 ], {
+ 'ndmin': ndims - 1
+ });
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var out;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ out = insertDimension( x, i%(ndims-1), false );
+ 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();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 2;
+ max = 10;
+
+ for ( i = min; i <= max; i++ ) {
+ f = createBenchmark( i );
+ bench( format( '%s::ndarray:ndims=%d', pkg, i ), f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/repl.txt
new file mode 100644
index 000000000000..bbe917dcd974
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/repl.txt
@@ -0,0 +1,42 @@
+
+{{alias}}( x, dim, writable )
+ Inserts a new dimension of size one at a specified dimension index of an
+ input ndarray.
+
+ A provided dimension index must reside on the interval `[-N-1, N]`, where
+ `N` is the rank (i.e., number of dimensions) of the provided input array.
+
+ If provided a negative dimension index, the position at which to insert a
+ singleton dimension is computed as `N + dim + 1`. Hence, if provided `-1`,
+ the resolved position is `N` (i.e., a singleton dimension is appended to the
+ input array).
+
+ The `writable` parameter only applies to ndarray constructors supporting
+ read-only instances.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ dim: integer
+ Dimension index at which to insert a singleton dimension.
+
+ writable: boolean
+ Boolean indicating whether the returned ndarray should be writable.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] )
+ [ [ 1, 2 ], [ 3, 4 ] ]
+ > var y = {{alias}}( x, 1, false )
+ [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/index.d.ts
new file mode 100644
index 000000000000..ff652d5ae1e1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/index.d.ts
@@ -0,0 +1,51 @@
+/*
+* @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 { typedndarray } from '@stdlib/types/ndarray';
+
+/**
+* Inserts a new dimension of size one at a specified dimension index of an input ndarray.
+*
+* ## Notes
+*
+* - A provided dimension index must reside on the interval `[-N-1, N]`, where `N` is the rank (i.e., number of dimensions) of the provided input array. If provided a negative dimension index, the position at which to insert a singleton dimension is computed as `N + dim + 1`. Hence, if provided `-1`, the resolved position is `N` (i.e., a singleton dimension is appended to the input array).
+*
+* @param x - input array
+* @param dim - dimension index at which to insert a singleton dimension
+* @param writable - boolean indicating whether the returned ndarray should be writable
+* @returns output array
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+* // returns [ [ 1, 2 ], [ 3, 4 ] ]
+*
+* var y = insertDimension( x, 1, false );
+* // returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
+*/
+declare function insertDimension = typedndarray>( x: U, dim: number, writable: boolean ): U;
+
+
+// EXPORTS //
+
+export = insertDimension;
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/test.ts
new file mode 100644
index 000000000000..b6a3294a18b2
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/docs/types/test.ts
@@ -0,0 +1,84 @@
+/*
+* @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 insertDimension = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ insertDimension( x, 1, false ); // $ExpectType float64ndarray
+}
+
+// The compiler throws an error if the function is not provided a first argument which is an ndarray...
+{
+ insertDimension( '5', 1, false ); // $ExpectError
+ insertDimension( 5, 1, false ); // $ExpectError
+ insertDimension( true, 1, false ); // $ExpectError
+ insertDimension( false, 1, false ); // $ExpectError
+ insertDimension( void 0, 1, false ); // $ExpectError
+ insertDimension( null, 1, false ); // $ExpectError
+ insertDimension( {}, 1, false ); // $ExpectError
+ insertDimension( [ '5' ], 1, false ); // $ExpectError
+ insertDimension( ( x: number ): number => x, 1, false ); // $ExpectError
+}
+
+// The compiler throws an error if the function is not provided a second argument which is a number...
+{
+ const x = zeros( [ 2, 2 ] );
+
+ insertDimension( x, '5', false ); // $ExpectError
+ insertDimension( x, true, false ); // $ExpectError
+ insertDimension( x, false, false ); // $ExpectError
+ insertDimension( x, void 0, false ); // $ExpectError
+ insertDimension( x, null, false ); // $ExpectError
+ insertDimension( x, {}, false ); // $ExpectError
+ insertDimension( x, [ '5' ], false ); // $ExpectError
+ insertDimension( x, ( x: number ): number => x, false ); // $ExpectError
+}
+
+// The compiler throws an error if the function is not provided a third argument which is a boolean...
+{
+ const x = zeros( [ 2, 2 ] );
+
+ insertDimension( x, 1, '5' ); // $ExpectError
+ insertDimension( x, 1, 5 ); // $ExpectError
+ insertDimension( x, 1, void 0 ); // $ExpectError
+ insertDimension( x, 1, null ); // $ExpectError
+ insertDimension( x, 1, {} ); // $ExpectError
+ insertDimension( x, 1, [ '5' ] ); // $ExpectError
+ insertDimension( x, 1, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ] );
+
+ insertDimension(); // $ExpectError
+ insertDimension( x ); // $ExpectError
+ insertDimension( x, 1 ); // $ExpectError
+ insertDimension( x, 1, false, [ 1, 2, 3 ] ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/examples/index.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/examples/index.js
new file mode 100644
index 000000000000..8de82ab09d32
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/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 insertDimension = require( './../lib' );
+
+var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
+console.log( ndarray2array( x ) );
+
+var y = insertDimension( x, 1, false );
+console.log( ndarray2array( y ) );
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/lib/index.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/lib/index.js
new file mode 100644
index 000000000000..3ff938cece4b
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/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';
+
+/**
+* Insert a new dimension of size one at a specified dimension index of an input ndarray.
+*
+* @module @stdlib/ndarray/base/insert-dimension
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+* var insertDimension = require( '@stdlib/ndarray/base/insert-dimension' );
+*
+* var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+* // returns [ [ 1, 2 ], [ 3, 4 ] ]
+*
+* var y = insertDimension( x, 1, false );
+* // returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/lib/main.js
new file mode 100644
index 000000000000..88cf652c0534
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/lib/main.js
@@ -0,0 +1,144 @@
+/**
+* @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 isRowMajorString = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
+var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' );
+var strides2order = require( '@stdlib/ndarray/base/strides2order' );
+var getDType = require( '@stdlib/ndarray/base/dtype' );
+var getShape = require( '@stdlib/ndarray/base/shape' );
+var getStrides = require( '@stdlib/ndarray/base/strides' );
+var getOffset = require( '@stdlib/ndarray/base/offset' );
+var getOrder = require( '@stdlib/ndarray/base/order' );
+var getData = require( '@stdlib/ndarray/base/data-buffer' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Inserts a new dimension of size one at a specified dimension index of an input ndarray.
+*
+* ## Notes
+*
+* - A provided dimension index must reside on the interval `[-N-1, N]`, where `N` is the rank (i.e., number of dimensions) of the provided input array. If provided a negative dimension index, the position at which to insert a singleton dimension is computed as `N + dim + 1`. Hence, if provided `-1`, the resolved position is `N` (i.e., a singleton dimension is appended to the input array).
+*
+* @param {ndarray} x - input array
+* @param {integer} dim - dimension index at which to insert a singleton dimension
+* @param {boolean} writable - boolean indicating whether the returned ndarray should be writable
+* @throws {RangeError} must provide a valid dimension index
+* @returns {ndarray} output array
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+* // returns [ [ 1, 2 ], [ 3, 4 ] ]
+*
+* var y = insertDimension( x, 1, false );
+* // returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
+*/
+function insertDimension( x, dim, writable ) {
+ var strides;
+ var shape;
+ var isrm;
+ var ord;
+ var sh;
+ var st;
+ var d;
+ var o;
+ var N;
+ var i;
+
+ sh = getShape( x, false );
+ st = getStrides( x, false );
+ ord = getOrder( x );
+
+ o = strides2order( st );
+ if ( o === 0 || o === 3 ) {
+ // Fallback to stated layout when unable to infer the underlying physical layout:
+ isrm = isRowMajorString( ord );
+ } else {
+ isrm = ( o === 1 );
+ }
+ N = sh.length;
+
+ strides = [];
+ shape = [];
+
+ d = normalizeIndex( dim, N );
+ if ( d === -1 ) {
+ throw new RangeError( format( 'invalid argument. Specified dimension index is out-of-bounds. Must be on the interval: [-%u, %u]. Value: `%d`.', N+1, N, dim ) );
+ }
+ if ( d === 0 ) {
+ // Prepend singleton dimension...
+ shape.push( 1 );
+ if ( isrm ) {
+ strides.push( sh[ 0 ] * st[ 0 ] );
+ } else {
+ strides.push( st[ 0 ] );
+ }
+ // Copy remaining dimensions...
+ for ( i = 0; i < N; i++ ) {
+ shape.push( sh[ i ] );
+ strides.push( st[ i ] );
+ }
+ } else if ( d === N ) {
+ // Copy dimensions...
+ for ( i = 0; i < N; i++ ) {
+ shape.push( sh[ i ] );
+ strides.push( st[ i ] );
+ }
+ // Append singleton dimension...
+ shape.push( 1 );
+ if ( isrm ) {
+ strides.push( st[ N-1 ] );
+ } else {
+ strides.push( sh[ N-1 ] * st[ N-1 ] );
+ }
+ } else {
+ // Insert a singleton dimension...
+ for ( i = 0; i < N+1; i++ ) {
+ if ( i === d ) {
+ shape.push( 1 );
+ if ( isrm ) {
+ strides.push( st[ i-1 ] );
+ } else { // ord === 'column-major'
+ strides.push( st[ i ] );
+ }
+ } else if ( i < d ) {
+ shape.push( sh[ i ] );
+ strides.push( st[ i ] );
+ } else { // i > d
+ shape.push( sh[ i-1 ] );
+ strides.push( st[ i-1 ] );
+ }
+ }
+ }
+ return new x.constructor( getDType( x ), getData( x ), shape, strides, getOffset( x ), ord, { // eslint-disable-line max-len
+ 'readonly': !writable
+ });
+}
+
+
+// EXPORTS //
+
+module.exports = insertDimension;
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/package.json b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/package.json
new file mode 100644
index 000000000000..7f4897a9b09e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "@stdlib/ndarray/base/insert-dimension",
+ "version": "0.0.0",
+ "description": "Insert a new dimension of size one at a specified dimension index of an input ndarray.",
+ "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",
+ "ndarray",
+ "insert",
+ "expand",
+ "broadcast",
+ "reshape",
+ "singleton",
+ "multidimensional",
+ "array",
+ "utilities",
+ "utility",
+ "utils",
+ "util"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/insert-dimension/test/test.js b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/test/test.js
new file mode 100644
index 000000000000..6892a729ca98
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/insert-dimension/test/test.js
@@ -0,0 +1,483 @@
+/**
+* @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 array = require( '@stdlib/ndarray/array' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var getStrides = require( '@stdlib/ndarray/strides' );
+var ndims = require( '@stdlib/ndarray/ndims' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var isReadOnly = require( '@stdlib/ndarray/base/assert/is-read-only' );
+var insertDimension = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof insertDimension, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided an invalid second argument', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ values = [
+ 10,
+ -10,
+ 99,
+ -99
+ ];
+ 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() {
+ insertDimension( x, value, false );
+ };
+ }
+});
+
+tape( 'the function prepends singleton dimensions (1d)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ 1, 2, 3, 4 ] );
+
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 4 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, 0, true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 4 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (2d)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, 0, true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, -ndims( x )-1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, -ndims( x )-1, true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (1d)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ 1, 2, 3, 4 ] );
+
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 4, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, ndims( x ), true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 4, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (2d)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, ndims( x ), true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, -1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, ndims( x ), true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, 1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, 1, true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions (negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ y = insertDimension( x, -2, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), true, 'returns expected value' );
+
+ y = insertDimension( x, -2, true );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+ t.strictEqual( isReadOnly( y ), false, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (base; row-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 4, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'row-major' );
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (base; row-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, -ndims( x )-1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 4, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (base; column-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+ y = insertDimension( x, 0, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 4, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function prepends singleton dimensions (base; column-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, -ndims( x )-1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 1, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (base; row-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 1, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'row-major' );
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 4 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (base; row-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, -1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 1, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (base; column-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 4 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+ y = insertDimension( x, ndims( x ), false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 1, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function appends singleton dimensions (base; column-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, -1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 4 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions (base; row-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, 1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'row-major' );
+ y = insertDimension( x, 1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions (base; row-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = insertDimension( x, -2, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions (base; column-major)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, 1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ // Transposed:
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+ y = insertDimension( x, 1, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 2, 2, 1 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function inserts singleton dimensions (base; column-major; negative index)', function test( t ) {
+ var x;
+ var y;
+
+ x = ndarray( 'generic', [ 1, 2, 3, 4 ], [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = insertDimension( x, -2, false );
+
+ t.notEqual( y, x, 'returns expected value' );
+ t.deepEqual( getShape( y ), [ 2, 1, 2 ], 'returns expected value' );
+ t.deepEqual( getStrides( y ), [ 1, 2, 2 ], 'returns expected value' );
+ t.strictEqual( getData( y ), getData( x ), 'returns expected value' );
+
+ t.end();
+});