diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/README.md b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/README.md
new file mode 100644
index 000000000000..9a91d06d458b
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/README.md
@@ -0,0 +1,243 @@
+
+
+# flattenShapeFrom
+
+> Flatten a shape starting from a specified dimension.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var flattenShapeFrom = require( '@stdlib/ndarray/base/flatten-shape-from' );
+```
+
+#### flattenShapeFrom( shape, dim )
+
+Flattens a shape starting from a specified dimension.
+
+```javascript
+var sh = flattenShapeFrom( [ 3, 3, 2 ], 1 );
+// returns [ 3, 6 ]
+```
+
+The function accepts the following parameters:
+
+- **shape**: array shape.
+- **dim**: dimension to start flattening from.
+
+#### flattenShapeFrom.assign( shape, dim, out )
+
+Flattens a shape starting from a specified dimension and assigns results to a provided output array.
+
+```javascript
+var sh = [ 0, 0 ];
+
+var out = flattenShapeFrom.assign( [ 3, 3, 2 ], 1, sh );
+// returns [ 3, 6 ]
+
+var bool = ( sh === out );
+// returns true
+```
+
+The function accepts the following parameters:
+
+- **shape**: array shape.
+- **dim**: dimension to start flattening from. If provided an integer less than zero, the dimension index is resolved relative to the last dimension, with the last dimension corresponding to the value `-1`.
+- **out**: output array.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var zip = require( '@stdlib/array/base/zip' );
+var logEachMap = require( '@stdlib/console/log-each-map' );
+var flattenShapeFrom = require( '@stdlib/ndarray/base/flatten-shape-from' );
+
+var opts = {
+ 'dtype': 'int32'
+};
+var d1 = discreteUniform( 100, 1, 10, opts );
+var d2 = discreteUniform( d1.length, 1, 10, opts );
+var d3 = discreteUniform( d1.length, 1, 10, opts );
+var d4 = discreteUniform( d1.length, 1, 10, opts );
+
+var dims = discreteUniform( d1.length, -4, 3, opts );
+var shapes = zip( [ d1, d2, d3, d4 ] );
+
+logEachMap( 'shape: (%s). dim: %d. flattened: (%s).', shapes, dims, flattenShapeFrom );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/ndarray/base/flatten_shape_from.h"
+```
+
+#### stdlib_ndarray_flatten_shape_from( ndims, \*shape, dim, \*out )
+
+Flattens a shape starting from a specified dimension.
+
+```c
+const int64_t ndims = 3;
+const int64_t shape[] = { 2, 3, 10 };
+int64_t out[ 2 ];
+
+stdlib_ndarray_flatten_shape( ndims, shape, 1, out );
+```
+
+The function accepts the following arguments:
+
+- **ndims**: `[in] int64_t` number of dimensions.
+- **shape**: `[in] int64_t*` array shape (dimensions).
+- **dim**: `[in] int64_t` dimension to start flattening from.
+- **out**: `[out] int64_t*` output array.
+
+```c
+int8_t stdlib_ndarray_flatten_shape_from( const int64_t ndims, const int64_t *shape, const int64_t dim, int64_t *out );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/ndarray/base/flatten_shape_from.h"
+#include
+#include
+
+int main( void ) {
+ const int64_t shape[] = { 2, 3, 4, 10 };
+ const int64_t ndims = 4;
+ const int64_t dim = 2;
+ int64_t out[ 3 ];
+
+ stdlib_ndarray_flatten_shape_from( ndims, shape, dim, out );
+
+ int i;
+ printf( "shape = ( " );
+ for ( i = 0; i < ndims-dim+1; i++ ) {
+ printf( "%"PRId64"", out[ i ] );
+ if ( i < ndims-dim ) {
+ printf( ", " );
+ }
+ }
+ printf( " )\n" );
+}
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/benchmark.js
new file mode 100644
index 000000000000..d68fac3eb5d4
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/benchmark.js
@@ -0,0 +1,82 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var isArray = require( '@stdlib/assert/is-array' );
+var pkg = require( './../package.json' ).name;
+var flattenShapeFrom = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var shape;
+ var out;
+ var i;
+
+ shape = discreteUniform( 5, 1, 10, {
+ 'dtype': 'generic'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ shape[ 0 ] += 1;
+ out = flattenShapeFrom( shape, 0 );
+ if ( out.length !== 1 ) {
+ b.fail( 'should have expected length' );
+ }
+ }
+ b.toc();
+ if ( !isArray( out ) ) {
+ b.fail( 'should return an array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':assign', function benchmark( b ) {
+ var shape;
+ var out;
+ var i;
+
+ shape = discreteUniform( 5, 1, 10, {
+ 'dtype': 'generic'
+ });
+
+ out = [ 0 ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ shape[ 0 ] += 1;
+ out = flattenShapeFrom.assign( shape, 0, out );
+ if ( out.length !== 1 ) {
+ b.fail( 'should have expected length' );
+ }
+ }
+ b.toc();
+ if ( !isArray( out ) ) {
+ b.fail( 'should return an array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/Makefile b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/Makefile
new file mode 100644
index 000000000000..5d7e79f50788
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/Makefile
@@ -0,0 +1,146 @@
+#/
+# @license Apache-2.0
+#
+# Copyright (c) 2025 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.
+#/
+
+# VARIABLES #
+
+ifndef VERBOSE
+ QUIET := @
+else
+ QUIET :=
+endif
+
+# Determine the OS ([1][1], [2][2]).
+#
+# [1]: https://en.wikipedia.org/wiki/Uname#Examples
+# [2]: http://stackoverflow.com/a/27776822/2225624
+OS ?= $(shell uname)
+ifneq (, $(findstring MINGW,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring MSYS,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring CYGWIN,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring Windows_NT,$(OS)))
+ OS := WINNT
+endif
+endif
+endif
+endif
+
+# Define the program used for compiling C source files:
+ifdef C_COMPILER
+ CC := $(C_COMPILER)
+else
+ CC := gcc
+endif
+
+# Define the command-line options when compiling C files:
+CFLAGS ?= \
+ -std=c99 \
+ -O3 \
+ -Wall \
+ -pedantic
+
+# Determine whether to generate position independent code ([1][1], [2][2]).
+#
+# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
+# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
+ifeq ($(OS), WINNT)
+ fPIC ?=
+else
+ fPIC ?= -fPIC
+endif
+
+# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
+INCLUDE ?=
+
+# List of source files:
+SOURCE_FILES ?=
+
+# List of libraries (e.g., `-lopenblas -lpthread`):
+LIBRARIES ?=
+
+# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
+LIBPATH ?=
+
+# List of C targets:
+c_targets := benchmark.out
+
+
+# RULES #
+
+#/
+# Compiles C source files.
+#
+# @param {string} SOURCE_FILES - list of C source files
+# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop`)
+# @param {string} [LIBRARIES] - list of libraries (e.g., `-lpthread -lblas`)
+# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
+# @param {string} [C_COMPILER] - C compiler
+# @param {string} [CFLAGS] - C compiler flags
+# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code
+#
+# @example
+# make
+#
+# @example
+# make all
+#/
+all: $(c_targets)
+
+.PHONY: all
+
+#/
+# Compiles C source files.
+#
+# @private
+# @param {string} SOURCE_FILES - list of C source files
+# @param {(string|void)} INCLUDE - list of includes (e.g., `-I /foo/bar -I /beep/boop`)
+# @param {(string|void)} LIBRARIES - list of libraries (e.g., `-lpthread -lblas`)
+# @param {(string|void)} LIBPATH - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
+# @param {string} CC - C compiler
+# @param {string} CFLAGS - C compiler flags
+# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code
+#/
+$(c_targets): %.out: %.c
+ $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
+
+#/
+# Runs compiled benchmarks.
+#
+# @example
+# make run
+#/
+run: $(c_targets)
+ $(QUIET) ./$<
+
+.PHONY: run
+
+#/
+# Removes generated files.
+#
+# @example
+# make clean
+#/
+clean:
+ $(QUIET) -rm -f *.o *.out
+
+.PHONY: clean
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/benchmark.c
new file mode 100644
index 000000000000..f73d6004b8f7
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/benchmark/c/benchmark.c
@@ -0,0 +1,140 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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.
+*/
+
+#include "stdlib/ndarray/base/flatten_shape_from.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define NAME "flatten-shape-from"
+#define ITERATIONS 1000000
+#define REPEATS 3
+
+/**
+* Prints the TAP version.
+*/
+static void print_version( void ) {
+ printf( "TAP version 13\n" );
+}
+
+/**
+* Prints the TAP summary.
+*
+* @param total total number of tests
+* @param passing total number of passing tests
+*/
+static void print_summary( int total, int passing ) {
+ printf( "#\n" );
+ printf( "1..%d\n", total ); // TAP plan
+ printf( "# total %d\n", total );
+ printf( "# pass %d\n", passing );
+ printf( "#\n" );
+ printf( "# ok\n" );
+}
+
+/**
+* Prints benchmarks results.
+*
+* @param elapsed elapsed time in seconds
+*/
+static void print_results( double elapsed ) {
+ double rate = (double)ITERATIONS / elapsed;
+ printf( " ---\n" );
+ printf( " iterations: %d\n", ITERATIONS );
+ printf( " elapsed: %0.9f\n", elapsed );
+ printf( " rate: %0.9f\n", rate );
+ printf( " ...\n" );
+}
+
+/**
+* Returns a clock time.
+*
+* @return clock time
+*/
+static double tic( void ) {
+ struct timeval now;
+ gettimeofday( &now, NULL );
+ return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
+}
+
+/**
+* Generates a random number on the interval [0,1).
+*
+* @return random number
+*/
+static double rand_double( void ) {
+ int r = rand();
+ return (double)r / ( (double)RAND_MAX + 1.0 );
+}
+
+/**
+* Runs a benchmark.
+*
+* @return elapsed time in seconds
+*/
+static double benchmark( void ) {
+ double elapsed;
+ double t;
+ int i;
+
+ int64_t shape[] = { 10, 10, 10 };
+ int64_t ndims = 3;
+ int64_t out[ 1 ];
+
+ t = tic();
+ for ( i = 0; i < ITERATIONS; i++ ) {
+ shape[ 0 ] += 1;
+ stdlib_ndarray_flatten_shape_from( ndims, shape, 0, out );
+ if ( out[ 0 ] < 0 ) {
+ printf( "unexpected result\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( out[ 0 ] < 0 ) {
+ printf( "unexpected result\n" );
+ }
+ return elapsed;
+}
+
+/**
+* Main execution sequence.
+*/
+int main( void ) {
+ double elapsed;
+ int count;
+ int i;
+
+ count = 0;
+
+ // Use the current time to seed the random number generator:
+ srand( time( NULL ) );
+
+ print_version();
+ for ( i = 0; i < REPEATS; i++ ) {
+ count += 1;
+ printf( "# c::native::%s\n", NAME );
+ elapsed = benchmark();
+ print_results( elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ print_summary( count, count );
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/repl.txt
new file mode 100644
index 000000000000..2cf12e3ca4fd
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/repl.txt
@@ -0,0 +1,59 @@
+
+{{alias}}( shape, dim )
+ Flattens a shape starting from a specified dimension.
+
+ Parameters
+ ----------
+ shape: ArrayLike
+ Array shape.
+
+ dim: integer
+ Dimension to start flattening from. If provided an integer less than
+ zero, the dimension index is resolved relative to the last dimension,
+ with the last dimension corresponding to the value `-1`.
+
+ Returns
+ -------
+ out: Array
+ Flattened shape.
+
+ Examples
+ --------
+ > var sh = [ 3, 3, 2 ];
+ > var out = {{alias}}( sh, 1 )
+ [ 3, 6 ]
+
+
+{{alias}}.assign( shape, dim, out )
+ Flattens a shape starting from a specified dimension and assigns results to
+ a provided output array.
+
+ Parameters
+ ----------
+ shape: ArrayLike
+ Array shape.
+
+ dim: integer
+ Dimension to start flattening from. If provided an integer less than
+ zero, the dimension index is resolved relative to the last dimension,
+ with the last dimension corresponding to the value `-1`.
+
+ out: Array|TypedArray|Object
+ Output array.
+
+ Returns
+ -------
+ out: Array|TypedArray|Object
+ Output array.
+
+ Examples
+ --------
+ > var sh = [ 2, 1, 10 ];
+ > var out = [ 0 ];
+ > var s = {{alias}}.assign( sh, 0, out )
+ [ 20 ]
+ > var bool = ( s === out )
+ true
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/index.d.ts
new file mode 100644
index 000000000000..cff0390a5639
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/index.d.ts
@@ -0,0 +1,50 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 { Collection } from '@stdlib/types/array';
+
+/**
+* Flattens a shape starting from a specified dimension.
+*
+* @param shape - array shape
+* @param dim - dimension to start flattening from
+* @returns flattened shape
+*
+* @example
+* var sh = flattenShapeFrom( [ 3, 3, 2 ], 1 );
+* // returns [ 3, 6 ]
+*
+* sh = flattenShapeFrom( [ 3, 2, 1 ], 1 );
+* // returns [ 3, 2 ]
+*
+* sh = flattenShapeFrom( [ 3 ], 0 );
+* // returns [ 3 ]
+*
+* sh = flattenShapeFrom( [ 3, 2 ], 0 );
+* // returns [ 6 ]
+*/
+declare function flattenShapeFrom( shape: Collection, dim: number ): Array;
+
+
+// EXPORTS //
+
+export = flattenShapeFrom;
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/test.ts
new file mode 100644
index 000000000000..8f0eec47c569
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/docs/types/test.ts
@@ -0,0 +1,58 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 flattenShapeFrom = require( './index' );
+
+
+// TESTS //
+
+// The function returns an array of numbers...
+{
+ flattenShapeFrom( [ 3, 2, 1 ], 1 ); // $ExpectType number[]
+}
+
+// The compiler throws an error if the function is provided a first argument that is not an array-like object containing numbers...
+{
+ flattenShapeFrom( true, 1 ); // $ExpectError
+ flattenShapeFrom( false, 1 ); // $ExpectError
+ flattenShapeFrom( null, 1 ); // $ExpectError
+ flattenShapeFrom( undefined, 1 ); // $ExpectError
+ flattenShapeFrom( '5', 1 ); // $ExpectError
+ flattenShapeFrom( [ '1', '2' ], 1 ); // $ExpectError
+ flattenShapeFrom( {}, 1 ); // $ExpectError
+ flattenShapeFrom( ( x: number ): number => x, 1 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument that is not a number...
+{
+ flattenShapeFrom( [ 2, 3 ], true ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], false ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], null ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], undefined ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], '5' ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], [ '1', '2' ] ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], {} ); // $ExpectError
+ flattenShapeFrom( [ 2, 3 ], ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ flattenShapeFrom(); // $ExpectError
+ flattenShapeFrom( [ 3, 2 ] ); // $ExpectError
+ flattenShapeFrom( [ 3, 2 ], 1, 0 ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/Makefile b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/Makefile
new file mode 100644
index 000000000000..25ced822f96a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/Makefile
@@ -0,0 +1,146 @@
+#/
+# @license Apache-2.0
+#
+# Copyright (c) 2025 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.
+#/
+
+# VARIABLES #
+
+ifndef VERBOSE
+ QUIET := @
+else
+ QUIET :=
+endif
+
+# Determine the OS ([1][1], [2][2]).
+#
+# [1]: https://en.wikipedia.org/wiki/Uname#Examples
+# [2]: http://stackoverflow.com/a/27776822/2225624
+OS ?= $(shell uname)
+ifneq (, $(findstring MINGW,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring MSYS,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring CYGWIN,$(OS)))
+ OS := WINNT
+else
+ifneq (, $(findstring Windows_NT,$(OS)))
+ OS := WINNT
+endif
+endif
+endif
+endif
+
+# Define the program used for compiling C source files:
+ifdef C_COMPILER
+ CC := $(C_COMPILER)
+else
+ CC := gcc
+endif
+
+# Define the command-line options when compiling C files:
+CFLAGS ?= \
+ -std=c99 \
+ -O3 \
+ -Wall \
+ -pedantic
+
+# Determine whether to generate position independent code ([1][1], [2][2]).
+#
+# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
+# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
+ifeq ($(OS), WINNT)
+ fPIC ?=
+else
+ fPIC ?= -fPIC
+endif
+
+# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
+INCLUDE ?=
+
+# List of source files:
+SOURCE_FILES ?=
+
+# List of libraries (e.g., `-lopenblas -lpthread`):
+LIBRARIES ?=
+
+# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
+LIBPATH ?=
+
+# List of C targets:
+c_targets := example.out
+
+
+# RULES #
+
+#/
+# Compiles source files.
+#
+# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
+# @param {string} [CFLAGS] - C compiler options
+# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
+# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
+# @param {string} [SOURCE_FILES] - list of source files
+# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
+# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
+#
+# @example
+# make
+#
+# @example
+# make all
+#/
+all: $(c_targets)
+
+.PHONY: all
+
+#/
+# Compiles C source files.
+#
+# @private
+# @param {string} CC - C compiler (e.g., `gcc`)
+# @param {string} CFLAGS - C compiler options
+# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
+# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
+# @param {string} SOURCE_FILES - list of source files
+# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
+# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
+#/
+$(c_targets): %.out: %.c
+ $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
+
+#/
+# Runs compiled examples.
+#
+# @example
+# make run
+#/
+run: $(c_targets)
+ $(QUIET) ./$<
+
+.PHONY: run
+
+#/
+# Removes generated files.
+#
+# @example
+# make clean
+#/
+clean:
+ $(QUIET) -rm -f *.o *.out
+
+.PHONY: clean
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/example.c b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/example.c
new file mode 100644
index 000000000000..146ac08c9cfb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/c/example.c
@@ -0,0 +1,40 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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.
+*/
+
+#include "stdlib/ndarray/base/flatten_shape_from.h"
+#include
+#include
+
+int main( void ) {
+ const int64_t shape[] = { 2, 3, 4, 10 };
+ const int64_t ndims = 4;
+ const int64_t dim = 2;
+ int64_t out[ 3 ];
+
+ stdlib_ndarray_flatten_shape_from( ndims, shape, dim, out );
+
+ int i;
+ printf( "shape = ( " );
+ for ( i = 0; i < ndims-dim+1; i++ ) {
+ printf( "%"PRId64"", out[ i ] );
+ if ( i < ndims-dim ) {
+ printf( ", " );
+ }
+ }
+ printf( " )\n" );
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/index.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/index.js
new file mode 100644
index 000000000000..f36308479607
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var zip = require( '@stdlib/array/base/zip' );
+var logEachMap = require( '@stdlib/console/log-each-map' );
+var flattenShapeFrom = require( './../lib' );
+
+var opts = {
+ 'dtype': 'int32'
+};
+var d1 = discreteUniform( 100, 1, 10, opts );
+var d2 = discreteUniform( d1.length, 1, 10, opts );
+var d3 = discreteUniform( d1.length, 1, 10, opts );
+var d4 = discreteUniform( d1.length, 1, 10, opts );
+
+var dims = discreteUniform( d1.length, -4, 3, opts );
+var shapes = zip( [ d1, d2, d3, d4 ] );
+
+logEachMap( 'shape: (%s). dim: %d. flattened: (%s).', shapes, dims, flattenShapeFrom );
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/include/stdlib/ndarray/base/flatten_shape_from.h b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/include/stdlib/ndarray/base/flatten_shape_from.h
new file mode 100644
index 000000000000..af6f75317453
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/include/stdlib/ndarray/base/flatten_shape_from.h
@@ -0,0 +1,40 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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.
+*/
+
+#ifndef STDLIB_NDARRAY_BASE_FLATTEN_SHAPE_FROM_H
+#define STDLIB_NDARRAY_BASE_FLATTEN_SHAPE_FROM_H
+
+#include
+
+/*
+* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* Flattens a shape starting from a specified dimension.
+*/
+int8_t stdlib_ndarray_flatten_shape_from( const int64_t ndims, const int64_t *shape, const int64_t dim, int64_t *out );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // !STDLIB_NDARRAY_BASE_FLATTEN_SHAPE_FROM_H
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/assign.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/assign.js
new file mode 100644
index 000000000000..e4758028baf0
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/assign.js
@@ -0,0 +1,84 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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';
+
+// MAIN //
+
+/**
+* Flattens a shape starting from a specified dimension and assigns results to a provided output array.
+*
+* @param {NonNegativeIntegerArray} shape - array shape
+* @param {integer} dim - dimension to start flattening from
+* @param {Collection} out - output object
+* @returns {Collection} array shape
+*
+* @example
+* var sh = [ 0, 0 ];
+*
+* var out = flattenShapeFrom( [ 3, 3, 2 ], 1, sh );
+* // returns [ 3, 6 ]
+*
+* var bool = ( out === sh );
+* // returns true
+*
+* @example
+* var sh = [ 0, 0 ];
+*
+* var out = flattenShapeFrom( [ 3, 3, 2 ], -2, sh );
+* // returns [ 3, 6 ]
+*
+* var bool = ( out === sh );
+* // returns true
+*/
+function flattenShapeFrom( shape, dim, out ) {
+ var ndims;
+ var s;
+ var i;
+ var j;
+
+ ndims = shape.length;
+
+ // Normalize the dimension index...
+ if ( dim < 0 ) {
+ dim += ndims;
+ if ( dim < 0 ) {
+ dim = 0;
+ }
+ }
+ s = 1;
+ j = 0;
+ for ( i = 0; i < ndims; i++ ) { // e.g., shape=[2,3,4,5], dim=2 => shape=[2,3,20]
+ if ( i >= dim ) {
+ s *= shape[ i ];
+ if ( i === ndims-1 ) {
+ out[ j ] = s;
+ j += 1;
+ }
+ } else {
+ out[ j ] = shape[ i ];
+ j += 1;
+ }
+ }
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = flattenShapeFrom;
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/index.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/index.js
new file mode 100644
index 000000000000..b1794a47f2d4
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/index.js
@@ -0,0 +1,49 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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';
+
+/**
+* Flatten a shape starting from a specified dimension.
+*
+* @module @stdlib/ndarray/base/flatten-shape-from
+*
+* @example
+* var flattenShapeFrom = require( '@stdlib/ndarray/base/flatten-shape-from' );
+*
+* var sh = flattenShapeFrom( [ 3, 3, 2 ], 1 );
+* // returns [ 3, 6 ]
+*/
+
+// MODULES //
+
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var assign = require( './assign.js' );
+
+
+// MAIN //
+
+setReadOnly( main, 'assign', assign );
+
+
+// EXPORTS //
+
+module.exports = main;
+
+// exports: { "assign": "main.assign" }
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/main.js
new file mode 100644
index 000000000000..12ae86921911
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/lib/main.js
@@ -0,0 +1,92 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 min = require( '@stdlib/math/base/special/fast/min' );
+var zeros = require( '@stdlib/array/base/zeros' );
+var assign = require( './assign.js' );
+
+
+// MAIN //
+
+/**
+* Flattens a shape starting from a specified dimension.
+*
+* @param {NonNegativeIntegerArray} shape - array shape
+* @param {integer} dim - dimension to start flattening from
+* @returns {NonNegativeIntegerArray} flattened shape
+*
+* @example
+* var sh = flattenShapeFrom( [ 3, 3, 2 ], 1 );
+* // returns [ 3, 6 ]
+*
+* sh = flattenShapeFrom( [ 3, 2, 1 ], 1 );
+* // returns [ 3, 2 ]
+*
+* sh = flattenShapeFrom( [ 3 ], 0 );
+* // returns [ 3 ]
+*
+* sh = flattenShapeFrom( [ 3, 2 ], 0 );
+* // returns [ 6 ]
+*
+* sh = flattenShapeFrom( [], 0 );
+* // returns []
+*
+* @example
+* var sh = flattenShapeFrom( [ 3, 3, 2 ], -2 );
+* // returns [ 3, 6 ]
+*
+* sh = flattenShapeFrom( [ 3, 2, 1 ], -2 );
+* // returns [ 3, 2 ]
+*
+* sh = flattenShapeFrom( [ 3 ], -1 );
+* // returns [ 3 ]
+*
+* sh = flattenShapeFrom( [ 3, 2 ], -2 );
+* // returns [ 6 ]
+*
+* sh = flattenShapeFrom( [], -1 );
+* // returns []
+*/
+function flattenShapeFrom( shape, dim ) {
+ var ndims;
+ var out;
+ var d;
+
+ ndims = shape.length;
+
+ // Normalize the dimension index...
+ if ( dim < 0 ) {
+ dim += ndims;
+ if ( dim < 0 ) {
+ dim = 0;
+ }
+ }
+ d = min( ndims-1, dim );
+ out = zeros( d+1 );
+ assign( shape, d, out );
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = flattenShapeFrom;
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/manifest.json b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/manifest.json
new file mode 100644
index 000000000000..04e61e361caa
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/manifest.json
@@ -0,0 +1,38 @@
+{
+ "options": {},
+ "fields": [
+ {
+ "field": "src",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "include",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "libraries",
+ "resolve": false,
+ "relative": false
+ },
+ {
+ "field": "libpath",
+ "resolve": true,
+ "relative": false
+ }
+ ],
+ "confs": [
+ {
+ "src": [
+ "./src/main.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": []
+ }
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/package.json b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/package.json
new file mode 100644
index 000000000000..cc37e0ad3d65
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "@stdlib/ndarray/base/flatten-shape-from",
+ "version": "0.0.0",
+ "description": "Flatten a shape starting from a specified dimension.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "include": "./include",
+ "lib": "./lib",
+ "src": "./src",
+ "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",
+ "shape",
+ "flatten",
+ "reshape",
+ "multidimensional",
+ "array",
+ "utilities",
+ "utility",
+ "utils",
+ "util"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/src/main.c b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/src/main.c
new file mode 100644
index 000000000000..a3b3127fe8ab
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/src/main.c
@@ -0,0 +1,69 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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.
+*/
+
+#include "stdlib/ndarray/base/flatten_shape_from.h"
+#include
+
+/**
+* Flattens a shape starting from a specified dimension.
+*
+* @param ndims number of dimensions
+* @param shape array shape (dimensions)
+* @param dim dimension to start flattening from
+* @param out output shape
+* @return status code
+*
+* @example
+* #include "stdlib/ndarray/base/flatten_shape_from.h"
+*
+* const int64_t ndims = 3;
+* const int64_t shape[] = { 2, 3, 10 };
+* int64_t out[ 2 ];
+*
+* stdlib_ndarray_flatten_shape( ndims, shape, 1, out );
+*/
+int8_t stdlib_ndarray_flatten_shape_from( const int64_t ndims, const int64_t *shape, const int64_t dim, int64_t *out ) {
+ int64_t d;
+ int64_t s;
+ int64_t i;
+ int64_t j;
+
+ // Normalize the dimension index...
+ d = dim;
+ if ( d < 0 ) {
+ d += ndims;
+ if ( d < 0 ) {
+ d = 0;
+ }
+ }
+ s = 1;
+ j = 0;
+ for ( i = 0; i < ndims; i++ ) { // e.g., shape=[2,3,4,5], dim=2 => shape=[2,3,20]
+ if ( i >= d ) {
+ s *= shape[ i ];
+ if ( i == ndims-1 ) {
+ out[ j ] = s;
+ j += 1;
+ }
+ } else {
+ out[ j ] = shape[ i ];
+ j += 1;
+ }
+ }
+ return 0;
+}
diff --git a/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/test/test.js b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/test/test.js
new file mode 100644
index 000000000000..bb06c3f6c91a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/base/flatten-shape-from/test/test.js
@@ -0,0 +1,233 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 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 isArray = require( '@stdlib/assert/is-array' );
+var flattenShapeFrom = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof flattenShapeFrom, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function flattens a provided shape starting from a specified dimension', function test( t ) {
+ var expected;
+ var actual;
+ var shape;
+
+ shape = [ 3, 2 ];
+ expected = [ 6 ];
+ actual = flattenShapeFrom( shape, 0 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 10 ];
+ actual = flattenShapeFrom( shape, 1 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+ actual = flattenShapeFrom( shape, 0 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+ actual = flattenShapeFrom( shape, 2 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+ actual = flattenShapeFrom( shape, 10 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ // Negative dimension indices...
+ shape = [ 3, 2 ];
+ expected = [ 6 ];
+ actual = flattenShapeFrom( shape, -2 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 10 ];
+ actual = flattenShapeFrom( shape, -2 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+ actual = flattenShapeFrom( shape, -3 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+ actual = flattenShapeFrom( shape, -10 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+ actual = flattenShapeFrom( shape, -1 );
+
+ t.strictEqual( isArray( actual ), true, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected length' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'attached to the main function is an `assign` method which supports flattening a provided shape starting from a specified dimension and assigning results to an output array', function test( t ) {
+ var expected;
+ var actual;
+ var shape;
+ var out;
+
+ shape = [ 3, 2 ];
+ expected = [ 6 ];
+
+ out = [ 0 ];
+ actual = flattenShapeFrom.assign( shape, 0, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 10 ];
+
+ out = [ 0, 0 ];
+ actual = flattenShapeFrom.assign( shape, 1, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+
+ out = [ 0 ];
+ actual = flattenShapeFrom.assign( shape, 0, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+
+ out = [ 0, 0, 0 ];
+ actual = flattenShapeFrom.assign( shape, 2, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+
+ out = [ 0, 0, 0 ];
+ actual = flattenShapeFrom.assign( shape, 10, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ // Negative indices...
+ shape = [ 3, 2 ];
+ expected = [ 6 ];
+
+ out = [ 0 ];
+ actual = flattenShapeFrom.assign( shape, -2, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 10 ];
+
+ out = [ 0, 0 ];
+ actual = flattenShapeFrom.assign( shape, -2, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+
+ out = [ 0 ];
+ actual = flattenShapeFrom.assign( shape, -3, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 20 ];
+
+ out = [ 0 ];
+ actual = flattenShapeFrom.assign( shape, -10, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ shape = [ 2, 1, 10 ];
+ expected = [ 2, 1, 10 ];
+
+ out = [ 0, 0, 0 ];
+ actual = flattenShapeFrom.assign( shape, -1, out );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.length, expected.length, 'returns expected value' );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});