diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/README.md b/lib/node_modules/@stdlib/ndarray/to-filled-slice/README.md
new file mode 100644
index 000000000000..934a0756732e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/README.md
@@ -0,0 +1,219 @@
+
+
+# toFilledSlice
+
+> Return a new [`ndarray`][@stdlib/ndarray/ctor] with a specified slice region filled with a provided value.
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var toFilledSlice = require( '@stdlib/ndarray/to-filled-slice' );
+```
+
+#### toFilledSlice( x, value, ...s\[, options] )
+
+Returns a new [`ndarray`][@stdlib/ndarray/ctor] with a specified slice region filled with a provided value.
+
+
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var Slice = require( '@stdlib/slice/ctor' );
+
+var x = zeros( [ 3, 4 ], {
+ 'dtype': 'float64'
+});
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+// Define an interior fill region:
+var s0 = new Slice( 1, 2 );
+var s1 = new Slice( 1, 3 );
+var s = new MultiSlice( s0, s1 );
+
+// Fill the region with a scalar value:
+var y = toFilledSlice( x, 9.0, s );
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+var bool = ( y === x );
+// returns false
+```
+
+The function accepts the following arguments:
+
+- **x**: input [`ndarray`][@stdlib/ndarray/ctor].
+- **value**: fill value.
+- **s**: a [`MultiSlice`][@stdlib/slice/multi] instance, an array of slice arguments, or slice arguments as separate arguments.
+- **options**: function options.
+
+The function supports three (mutually exclusive) means for providing slice arguments:
+
+1. providing a single [`MultiSlice`][@stdlib/slice/multi] instance.
+2. providing a single array of slice arguments.
+3. providing slice arguments as separate arguments.
+
+The following example demonstrates each invocation style achieving equivalent results.
+
+
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var Slice = require( '@stdlib/slice/ctor' );
+
+var s0 = new Slice( 1, 2 );
+var s1 = new Slice( 1, 3 );
+var s = new MultiSlice( s0, s1 );
+
+// 1. Using a MultiSlice:
+var x = zeros( [ 3, 4 ], {
+ 'dtype': 'float64'
+});
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+var out = toFilledSlice( x, 9.0, s );
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+// 2. Using an array of slice arguments:
+out = toFilledSlice( x, 9.0, [ s0, s1 ] );
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+// 3. Providing separate arguments:
+out = toFilledSlice( x, 9.0, s0, s1 );
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+```
+
+The function supports the following options:
+
+- **strict**: boolean indicating whether to enforce strict bounds checking.
+
+By default, the function throws an error when provided a slice which exceeds array bounds. To ignore slice indices exceeding array bounds, set the `strict` option to `false`.
+
+
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var Slice = require( '@stdlib/slice/ctor' );
+
+var x = zeros( [ 3, 4 ], {
+ 'dtype': 'float64'
+});
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+
+// Define the fill region:
+var s0 = new Slice( 1, null, 1 );
+var s1 = new Slice( 10, 20, 1 );
+var s = new MultiSlice( s0, s1 );
+
+// Return a copy of `x` (out-of-bounds slice is ignored):
+var y = toFilledSlice( x, 9.0, s, {
+ 'strict': false
+});
+// returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+```
+
+
+
+
+
+
+
+## Notes
+
+- The function does **not** mutate the input [`ndarray`][@stdlib/ndarray/ctor].
+- The output [`ndarray`][@stdlib/ndarray/ctor] has the same [data type][@stdlib/ndarray/dtypes], shape, and memory layout as the input [`ndarray`][@stdlib/ndarray/ctor].
+- A **slice argument** must be either a [`Slice`][@stdlib/slice/ctor], an integer, `null`, or `undefined`.
+- Each slice argument must have an absolute index increment equal to one. Otherwise, the function throws an error.
+- If a fill value is a number and `x` has a complex [data type][@stdlib/ndarray/dtypes], the function fills the specified region with a complex number whose real component equals the provided fill `value` and whose imaginary component is zero.
+- A fill value must be able to safely cast to the input [`ndarray`][@stdlib/ndarray/ctor] [data type][@stdlib/ndarray/dtypes]. Fill values having floating-point data types (both real and complex) are allowed to downcast to a lower precision data type of the same kind (e.g., a scalar double-precision floating-point number can be used to fill a `'float32'` input [`ndarray`][@stdlib/ndarray/ctor]).
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteUniform = require( '@stdlib/random/discrete-uniform' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var Slice = require( '@stdlib/slice/ctor' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var toFilledSlice = require( '@stdlib/ndarray/to-filled-slice' );
+
+// Create an input ndarray:
+var x = discreteUniform( [ 2, 3, 4 ], -10, 10, {
+ 'dtype': 'float64'
+});
+console.log( ndarray2array( x ) );
+
+// Define the fill region:
+var s0 = new Slice( 1, 2 );
+var s1 = new Slice( null, null );
+var s2 = new Slice( 2, 4 );
+var s = new MultiSlice( s0, s1, s2 );
+
+// Fill the region with a scalar value:
+var y = toFilledSlice( x, 0.0, s );
+console.log( ndarray2array( y ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/slice/multi]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/slice/multi
+
+[@stdlib/slice/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/slice/ctor
+
+[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
+
+[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/dtypes
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.1d.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.1d.js
new file mode 100644
index 000000000000..efc7b13b27cc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.1d.js
@@ -0,0 +1,125 @@
+/**
+* @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 pow = require( '@stdlib/math/base/special/pow' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var discreteUniform = require( '@stdlib/random/discrete-uniform' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var toFilledSlice = require( './../lib' );
+
+
+// VARIABLES //
+
+var types = [ 'float64' ];
+var orders = [ 'row-major', 'column-major' ];
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {NonNegativeIntegerArray} shape - ndarray shape
+* @param {string} xtype - input ndarray data type
+* @param {string} order - memory layout
+* @returns {Function} benchmark function
+*/
+function createBenchmark( shape, xtype, order ) {
+ var x;
+ var s;
+
+ x = discreteUniform( shape, -10, 10, {
+ 'dtype': xtype,
+ 'order': order
+ });
+ s = new MultiSlice( null );
+ 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 = toFilledSlice( x, i, s );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ 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 len;
+ var min;
+ var max;
+ var ord;
+ var sh;
+ var t1;
+ var f;
+ var i;
+ var j;
+ var k;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( k = 0; k < orders.length; k++ ) {
+ ord = orders[ k ];
+ for ( j = 0; j < types.length; j++ ) {
+ t1 = types[ j ];
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+
+ sh = [ len ];
+ f = createBenchmark( sh, t1, ord );
+ bench( format( '%s:ndims=%d,len=%d,shape=[%s],xorder=%s,xtype=%s', pkg, sh.length, len, sh.join( ',' ), ord, t1 ), f );
+ }
+ }
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.2d.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.2d.js
new file mode 100644
index 000000000000..f046cbe45930
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/benchmark/benchmark.2d.js
@@ -0,0 +1,130 @@
+/**
+* @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 pow = require( '@stdlib/math/base/special/pow' );
+var floor = require( '@stdlib/math/base/special/floor' );
+var sqrt = require( '@stdlib/math/base/special/sqrt' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var discreteUniform = require( '@stdlib/random/discrete-uniform' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var toFilledSlice = require( './../lib' );
+
+
+// VARIABLES //
+
+var types = [ 'float64' ];
+var orders = [ 'row-major', 'column-major' ];
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {NonNegativeIntegerArray} shape - ndarray shape
+* @param {string} xtype - input ndarray data type
+* @param {string} order - memory layout
+* @returns {Function} benchmark function
+*/
+function createBenchmark( shape, xtype, order ) {
+ var x;
+ var s;
+
+ x = discreteUniform( shape, -10, 10, {
+ 'dtype': xtype,
+ 'order': order
+ });
+ s = new MultiSlice( null, null );
+ 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 = toFilledSlice( x, i, s );
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ 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 len;
+ var min;
+ var max;
+ var ord;
+ var sh;
+ var t1;
+ var f;
+ var i;
+ var j;
+ var k;
+ var n;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( k = 0; k < orders.length; k++ ) {
+ ord = orders[ k ];
+ for ( j = 0; j < types.length; j++ ) {
+ t1 = types[ j ];
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+
+ n = floor( sqrt( len ) );
+ sh = [ n, n ];
+ len = n * n;
+ f = createBenchmark( sh, t1, ord );
+ bench( format( '%s:ndims=%d,len=%d,shape=[%s],xorder=%s,xtype=%s', pkg, sh.length, len, sh.join( ',' ), ord, t1 ), f );
+ }
+ }
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/repl.txt
new file mode 100644
index 000000000000..351badb4430f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/repl.txt
@@ -0,0 +1,73 @@
+
+{{alias}}( x, value, ...s[, options] )
+ Returns a new ndarray with a specified slice region filled with a provided
+ value.
+
+ The function does not mutate the input ndarray. The output ndarray has the
+ same data type, shape, and memory layout as the input ndarray.
+
+ The function supports three (mutually exclusive) means of providing slice
+ arguments:
+
+ 1. Providing a single MultiSlice object.
+ 2. Providing a single array containing slice arguments.
+ 3. Providing slice arguments as separate arguments.
+
+ An individual slice argument must be either a Slice, an integer, null, or
+ undefined.
+
+ Each slice argument must have an absolute index increment equal to one.
+ Otherwise, the function throws an error.
+
+ If providing a MultiSlice object or an array of slice arguments, no other
+ slice arguments should be provided.
+
+ Mixing function invocation styles (e.g., providing multiple MultiSlice
+ objects or providing an array of slice arguments followed by additional
+ slice arguments) is not supported.
+
+ If a fill value is a number and `x` has a complex data type, the function
+ fills the specified region with a complex number whose real component
+ equals the provided fill value and whose imaginary component is zero.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input ndarray.
+
+ value: any
+ Fill value. Must be able to safely cast to the input ndarray data type.
+ Fill values having floating-point data types (both real and complex) are
+ allowed to downcast to a lower precision data type of the same kind
+ (e.g., a scalar double-precision floating-point number can be used to
+ fill a 'float32' input ndarray).
+
+ s: ...MultiSlice|Slice|null|undefined|integer|ArrayLike
+ Slice arguments.
+
+ options: Object (optional)
+ Options.
+
+ options.strict: boolean (optional)
+ Boolean indicating whether to enforce strict bounds checking. Default:
+ true.
+
+ Returns
+ -------
+ out: ndarray
+ Output ndarray.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] )
+ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
+ > var s0 = new {{alias:@stdlib/slice/ctor}}( 0, 1 );
+ > var s1 = new {{alias:@stdlib/slice/ctor}}( null, null );
+ > var s = new {{alias:@stdlib/slice/multi}}( s0, s1 );
+ > var y = {{alias}}( x, 10.0, s )
+ [ [ 10.0, 10.0 ], [ 3.0, 4.0 ] ]
+ > var bool = ( y === x )
+ false
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/types/test.ts
new file mode 100644
index 000000000000..65d839a02544
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/docs/types/test.ts
@@ -0,0 +1,185 @@
+/*
+* @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 Complex128 = require( '@stdlib/complex/float64/ctor' );
+import Complex64 = require( '@stdlib/complex/float32/ctor' );
+import MultiSlice = require( '@stdlib/slice/multi' );
+import toFilledSlice = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float64' } ), 10.0, s ); // $ExpectType float64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float32' } ), 10.0, s ); // $ExpectType float32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ), new Complex128( 10.0, 0.0 ), s ); // $ExpectType complex128ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ), 10.0, s ); // $ExpectType complex128ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex64' } ), new Complex64( 10.0, 0.0 ), s ); // $ExpectType complex64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex64' } ), 10.0, s ); // $ExpectType complex64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int32' } ), 10.0, s ); // $ExpectType int32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int16' } ), 10.0, s ); // $ExpectType int16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int8' } ), 10.0, s ); // $ExpectType int8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint32' } ), 10.0, s ); // $ExpectType uint32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint16' } ), 10.0, s ); // $ExpectType uint16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8' } ), 10.0, s ); // $ExpectType uint8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8c' } ), 10.0, s ); // $ExpectType uint8cndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'generic' } ), 10.0, s ); // $ExpectType genericndarray
+
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float64' } ), 10.0, s, { 'strict': false } ); // $ExpectType float64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float32' } ), 10.0, s, { 'strict': false } ); // $ExpectType float32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ), new Complex128( 10.0, 0.0 ), s, { 'strict': false } ); // $ExpectType complex128ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex64' } ), new Complex64( 10.0, 0.0 ), s, { 'strict': false } ); // $ExpectType complex64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int32' } ), 10.0, s, { 'strict': false } ); // $ExpectType int32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int16' } ), 10.0, s, { 'strict': false } ); // $ExpectType int16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int8' } ), 10.0, s, { 'strict': false } ); // $ExpectType int8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint32' } ), 10.0, s, { 'strict': false } ); // $ExpectType uint32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint16' } ), 10.0, s, { 'strict': false } ); // $ExpectType uint16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8' } ), 10.0, s, { 'strict': false } ); // $ExpectType uint8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8c' } ), 10.0, s, { 'strict': false } ); // $ExpectType uint8cndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'generic' } ), 10.0, s, { 'strict': false } ); // $ExpectType genericndarray
+
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float64' } ), 10.0, s, { 'strict': true } ); // $ExpectType float64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'float32' } ), 10.0, s, { 'strict': true } ); // $ExpectType float32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ), new Complex128( 10.0, 0.0 ), s, { 'strict': true } ); // $ExpectType complex128ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'complex64' } ), new Complex64( 10.0, 0.0 ), s, { 'strict': true } ); // $ExpectType complex64ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int32' } ), 10.0, s, { 'strict': true } ); // $ExpectType int32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int16' } ), 10.0, s, { 'strict': true } ); // $ExpectType int16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'int8' } ), 10.0, s, { 'strict': true } ); // $ExpectType int8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint32' } ), 10.0, s, { 'strict': true } ); // $ExpectType uint32ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint16' } ), 10.0, s, { 'strict': true } ); // $ExpectType uint16ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8' } ), 10.0, s, { 'strict': true } ); // $ExpectType uint8ndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'uint8c' } ), 10.0, s, { 'strict': true } ); // $ExpectType uint8cndarray
+ toFilledSlice( zeros( [ 2, 2 ], { 'dtype': 'generic' } ), 10.0, s, { 'strict': true } ); // $ExpectType genericndarray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice( '10', 10.0, s ); // $ExpectError
+ toFilledSlice( 10, 10.0, s ); // $ExpectError
+ toFilledSlice( false, 10.0, s ); // $ExpectError
+ toFilledSlice( true, 10.0, s ); // $ExpectError
+ toFilledSlice( null, 10.0, s ); // $ExpectError
+ toFilledSlice( [], 10.0, s ); // $ExpectError
+ toFilledSlice( {}, 10.0, s ); // $ExpectError
+ toFilledSlice( ( x: number ): number => x, 10.0, s ); // $ExpectError
+
+ toFilledSlice( '10', 10.0, s, {} ); // $ExpectError
+ toFilledSlice( 10, 10.0, s, {} ); // $ExpectError
+ toFilledSlice( false, 10.0, s, {} ); // $ExpectError
+ toFilledSlice( true, 10.0, s, {} ); // $ExpectError
+ toFilledSlice( null, 10.0, s, {} ); // $ExpectError
+ toFilledSlice( [], 10.0, s, {} ); // $ExpectError
+ toFilledSlice( {}, 10.0, s, {} ); // $ExpectError
+ toFilledSlice( ( x: number ): number => x, 10.0, s, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid second argument...
+{
+ const x = zeros( [ 2, 2 ] );
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice( x, '10', s ); // $ExpectError
+ toFilledSlice( x, false, s ); // $ExpectError
+ toFilledSlice( x, true, s ); // $ExpectError
+ toFilledSlice( x, null, s ); // $ExpectError
+ toFilledSlice( x, [], s ); // $ExpectError
+ toFilledSlice( x, {}, s ); // $ExpectError
+ toFilledSlice( x, ( x: number ): number => x, s ); // $ExpectError
+
+ toFilledSlice( x, '10', s, {} ); // $ExpectError
+ toFilledSlice( x, false, s, {} ); // $ExpectError
+ toFilledSlice( x, true, s, {} ); // $ExpectError
+ toFilledSlice( x, null, s, {} ); // $ExpectError
+ toFilledSlice( x, [], s, {} ); // $ExpectError
+ toFilledSlice( x, {}, s, {} ); // $ExpectError
+ toFilledSlice( x, ( x: number ): number => x, s, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid slice argument...
+{
+ const x = zeros( [ 2, 2 ] );
+
+ toFilledSlice( x, 10.0, '5' ); // $ExpectError
+ toFilledSlice( x, 10.0, false ); // $ExpectError
+ toFilledSlice( x, 10.0, true ); // $ExpectError
+ toFilledSlice( x, 10.0, [ '5' ] ); // $ExpectError
+ toFilledSlice( x, 10.0, ( x: number ): number => x ); // $ExpectError
+
+ toFilledSlice( x, 10.0, null, '5' ); // $ExpectError
+ toFilledSlice( x, 10.0, null, false ); // $ExpectError
+ toFilledSlice( x, 10.0, null, true ); // $ExpectError
+ toFilledSlice( x, 10.0, null, [ '5' ] ); // $ExpectError
+ toFilledSlice( x, 10.0, null, ( x: number ): number => x ); // $ExpectError
+
+ toFilledSlice( x, 10.0, '5', {} ); // $ExpectError
+ toFilledSlice( x, 10.0, false, {} ); // $ExpectError
+ toFilledSlice( x, 10.0, true, {} ); // $ExpectError
+ toFilledSlice( x, 10.0, [ '5' ], {} ); // $ExpectError
+ toFilledSlice( x, 10.0, ( x: number ): number => x, {} ); // $ExpectError
+
+ toFilledSlice( x, 10.0, null, '5', {} ); // $ExpectError
+ toFilledSlice( x, 10.0, null, false, {} ); // $ExpectError
+ toFilledSlice( x, 10.0, null, true, {} ); // $ExpectError
+ toFilledSlice( x, 10.0, null, [ '5' ], {} ); // $ExpectError
+ toFilledSlice( x, 10.0, null, ( x: number ): number => x, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ] );
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice( x, 10.0, s, '5' ); // $ExpectError
+ toFilledSlice( x, 10.0, s, 5 ); // $ExpectError
+ toFilledSlice( x, 10.0, s, null ); // $ExpectError
+ toFilledSlice( x, 10.0, s, true ); // $ExpectError
+ toFilledSlice( x, 10.0, s, false ); // $ExpectError
+ toFilledSlice( x, 10.0, s, [ '5' ] ); // $ExpectError
+ toFilledSlice( x, 10.0, s, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a `strict` option which is not a boolean...
+{
+ const x = zeros( [ 2, 2 ] );
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice( x, 10.0, s, { 'strict': '5' } ); // $ExpectError
+ toFilledSlice( x, 10.0, s, { 'strict': 5 } ); // $ExpectError
+ toFilledSlice( x, 10.0, s, { 'strict': null } ); // $ExpectError
+ toFilledSlice( x, 10.0, s, { 'strict': [ '5' ] } ); // $ExpectError
+ toFilledSlice( x, 10.0, s, { 'strict': {} } ); // $ExpectError
+ toFilledSlice( x, 10.0, s, { 'strict': ( 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 ] );
+ const s = new MultiSlice( null, null );
+
+ toFilledSlice(); // $ExpectError
+ toFilledSlice( x ); // $ExpectError
+ toFilledSlice( x, 10.0, s, {}, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/examples/index.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/examples/index.js
new file mode 100644
index 000000000000..e3093d578e9c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/examples/index.js
@@ -0,0 +1,41 @@
+/**
+* @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 discreteUniform = require( '@stdlib/random/discrete-uniform' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var Slice = require( '@stdlib/slice/ctor' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var toFilledSlice = require( './../lib' );
+
+// Create an input ndarray:
+var x = discreteUniform( [ 2, 3, 4 ], -10, 10, {
+ 'dtype': 'float64'
+});
+console.log( ndarray2array( x ) );
+
+// Define the fill region:
+var s0 = new Slice( 1, 2 );
+var s1 = new Slice( null, null );
+var s2 = new Slice( 2, 4 );
+var s = new MultiSlice( s0, s1, s2 );
+
+// Fill the region with a scalar value:
+var y = toFilledSlice( x, 0.0, s );
+console.log( ndarray2array( y ) );
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/index.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/index.js
new file mode 100644
index 000000000000..48216ea4ad36
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/index.js
@@ -0,0 +1,57 @@
+/**
+* @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 with a specified slice region filled with a provided value.
+*
+* @module @stdlib/ndarray/to-filled-slice
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var MultiSlice = require( '@stdlib/slice/multi' );
+* var Slice = require( '@stdlib/slice/ctor' );
+* var toFilledSlice = require( '@stdlib/ndarray/to-filled-slice' );
+*
+* var x = zeros( [ 3, 4 ], {
+* 'dtype': 'float64'
+* });
+* // returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+*
+* // Define an interior fill region:
+* var s0 = new Slice( 1, 2 );
+* var s1 = new Slice( 1, 3 );
+* var s = new MultiSlice( s0, s1 );
+*
+* // Fill the region with a scalar value:
+* var y = toFilledSlice( x, 9.0, s );
+* // returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+*
+* var bool = ( y === x );
+* // returns false
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/main.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/main.js
new file mode 100644
index 000000000000..241c24fe5f9c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/main.js
@@ -0,0 +1,201 @@
+/**
+* @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 isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' );
+var isPlainObject = require( '@stdlib/assert/is-plain-object' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
+var isMultiSlice = require( '@stdlib/assert/is-multi-slice' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var args2multislice = require( '@stdlib/slice/base/args2multislice' );
+var normalizeMultiSlice = require( '@stdlib/slice/base/normalize-multi-slice' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var emptyLike = require( '@stdlib/ndarray/empty-like' );
+var sliceBase = require( '@stdlib/ndarray/base/slice' );
+var assign = require( '@stdlib/ndarray/base/assign' );
+var fillBase = require( '@stdlib/ndarray/base/fill' );
+var format = require( '@stdlib/string/format' );
+var slab = require( './slab.js' );
+
+
+// MAIN //
+
+/**
+* Returns a new ndarray with a specified slice region filled with a provided value.
+*
+* @param {ndarray} x - input ndarray
+* @param {*} value - fill value
+* @param {...*} s - slice arguments
+* @param {Options} [options] - options
+* @param {boolean} [options.strict] - boolean indicating whether to enforce strict bounds checking
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} second argument cannot be safely cast to the input ndarray data type
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} must provide valid options
+* @throws {RangeError} number of slice dimensions must match the number of input array dimensions
+* @throws {RangeError} slice arguments must have an absolute index increment equal to one
+* @throws {Error} too many arguments
+* @returns {ndarray} output ndarray
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var MultiSlice = require( '@stdlib/slice/multi' );
+* var Slice = require( '@stdlib/slice/ctor' );
+*
+* var x = zeros( [ 3, 4 ], {
+* 'dtype': 'float64'
+* });
+* // returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+*
+* // Define an interior fill region:
+* var s0 = new Slice( 1, 2 );
+* var s1 = new Slice( 1, 3 );
+* var s = new MultiSlice( s0, s1 );
+*
+* // Fill the region with a scalar value:
+* var y = toFilledSlice( x, 9.0, s );
+* // returns [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 9.0, 9.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ]
+*
+* var bool = ( y === x );
+* // returns false
+*/
+function toFilledSlice( x, value, s ) {
+ var options;
+ var slices;
+ var nargs;
+ var args;
+ var norm;
+ var opts;
+ var out;
+ var hi;
+ var lo;
+ var ms;
+ var sd;
+ var sh;
+ var S;
+ var d;
+ var i;
+
+ opts = {
+ 'strict': true
+ };
+ nargs = arguments.length;
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
+ }
+ sh = getShape( x );
+ if ( isPlainObject( arguments[ nargs-1 ] ) ) {
+ nargs -= 1;
+ options = arguments[ nargs ];
+ if ( hasOwnProp( options, 'strict' ) ) {
+ if ( !isBoolean( options.strict ) ) {
+ throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'strict', options.strict ) );
+ }
+ opts.strict = options.strict;
+ }
+ }
+ if ( isMultiSlice( s ) ) {
+ S = s;
+ if ( nargs > 3 ) {
+ throw new Error( 'invalid invocation. Too many arguments.' );
+ }
+ } else {
+ if ( isArrayLikeObject( s ) ) {
+ args = s;
+ if ( nargs > 3 ) {
+ throw new Error( 'invalid invocation. Too many arguments.' );
+ }
+ } else {
+ args = [];
+ for ( i = 2; i < nargs; i++ ) {
+ args.push( arguments[ i ] );
+ }
+ }
+ try {
+ S = args2multislice( args );
+ } catch ( err ) { // eslint-disable-line no-unused-vars
+ // Search for the first offending value...
+ for ( i = 0; i < args.length; i++ ) {
+ try {
+ new MultiSlice( args[ i ] ); // eslint-disable-line no-new
+ } catch ( err ) { // eslint-disable-line no-unused-vars
+ throw new TypeError( format( 'invalid argument. Slice arguments must be either a Slice, integer, null, or undefined. Value: `%s`.', String( args[ i ] ) ) );
+ }
+ }
+ }
+ }
+
+ // Validate that the number of slice dimensions matches the number of input array dimensions:
+ if ( S.ndims !== sh.length ) {
+ throw new RangeError( format( 'invalid argument. Number of slice dimensions does not match the number of array dimensions. Array shape: (%s). Slice dimensions: %u.', sh.join( ',' ), S.ndims ) );
+ }
+ out = emptyLike( x );
+
+ // If a zero-dimensional input array, the slab loop is a no-op, and we only need to fill the zero-dimensional view of `out`:
+ if ( sh.length === 0 ) {
+ fillBase( sliceBase( out, S, opts.strict, true ), value );
+ return out;
+ }
+ // Resolve normalized slices in order to carve out complement slabs:
+ norm = normalizeMultiSlice( S, sh, opts.strict );
+ if ( norm.code ) {
+ throw new RangeError( format( 'invalid argument. Slice exceeds array bounds. Array shape: (%s).', sh.join( ',' ) ) );
+ }
+ slices = norm.data;
+
+ // Reject slices having a non-unit absolute index increment:
+ for ( i = 0; i < slices.length; i++ ) {
+ if ( slices[ i ].step !== 1 ) {
+ throw new RangeError( format( 'invalid argument. Slice arguments must have an absolute index increment equal to one. Value: `%d`.', slices[ i ].step ) );
+ }
+ if ( slices[ i ].start === slices[ i ].stop ) {
+ assign( [ x, out ] );
+ return out;
+ }
+ }
+ // Carve `2N` complement slabs by, for each dimension, copying the cells which fall before and after the fill region along that dimension:
+ for ( d = 0; d < sh.length; d++ ) {
+ sd = slices[ d ];
+ lo = sd.start;
+ hi = sd.stop;
+
+ // "Before" slab on dimension `d`:
+ if ( lo > 0 ) {
+ ms = slab( sh, slices, d, 0, lo );
+ assign( [ sliceBase( x, ms, false, false ), sliceBase( out, ms, false, true ) ] ); // eslint-disable-line max-len
+ }
+ // "After" slab on dimension `d`:
+ if ( hi < sh[ d ] ) {
+ ms = slab( sh, slices, d, hi, sh[ d ] );
+ assign( [ sliceBase( x, ms, false, false ), sliceBase( out, ms, false, true ) ] ); // eslint-disable-line max-len
+ }
+ }
+ // Fill the region itself with the provided value:
+ fillBase( sliceBase( out, S, opts.strict, true ), value );
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = toFilledSlice;
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/slab.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/slab.js
new file mode 100644
index 000000000000..dc8ce532b071
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/lib/slab.js
@@ -0,0 +1,58 @@
+/**
+* @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 args2multislice = require( '@stdlib/slice/base/args2multislice' );
+var Slice = require( '@stdlib/slice/ctor' );
+
+
+// MAIN //
+
+/**
+* Returns a multi-slice describing a single complement slab along a specified dimension.
+*
+* @private
+* @param {NonNegativeIntegerArray} shape - input ndarray shape
+* @param {Array} slices - normalized fill region slices
+* @param {NonNegativeInteger} d - slab dimension
+* @param {NonNegativeInteger} start - inclusive start index along dimension `d`
+* @param {NonNegativeInteger} stop - exclusive stop index along dimension `d`
+* @returns {MultiSlice} multi-slice describing the slab
+*/
+function slab( shape, slices, d, start, stop ) {
+ var args;
+ var k;
+
+ args = [];
+ for ( k = 0; k < d; k++ ) {
+ args.push( slices[ k ] );
+ }
+ args.push( new Slice( start, stop, 1 ) );
+ for ( k = d + 1; k < shape.length; k++ ) {
+ args.push( new Slice( 0, shape[ k ], 1 ) );
+ }
+ return args2multislice( args );
+}
+
+
+// EXPORTS //
+
+module.exports = slab;
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/package.json b/lib/node_modules/@stdlib/ndarray/to-filled-slice/package.json
new file mode 100644
index 000000000000..ce7372a45e9a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/ndarray/to-filled-slice",
+ "version": "0.0.0",
+ "description": "Return a new ndarray with a specified slice region filled with a provided value.",
+ "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",
+ "strided",
+ "array",
+ "ndarray",
+ "matrix",
+ "vector",
+ "fill",
+ "slice",
+ "view",
+ "transform",
+ "copy",
+ "immutable"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ndarray/to-filled-slice/test/test.js b/lib/node_modules/@stdlib/ndarray/to-filled-slice/test/test.js
new file mode 100644
index 000000000000..b6b7f27b9e89
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/to-filled-slice/test/test.js
@@ -0,0 +1,1069 @@
+/**
+* @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 Complex128 = require( '@stdlib/complex/float64/ctor' );
+var real = require( '@stdlib/complex/float64/real' );
+var imag = require( '@stdlib/complex/float64/imag' );
+var isReadOnly = require( '@stdlib/ndarray/base/assert/is-read-only' );
+var ndzeros = require( '@stdlib/ndarray/zeros' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var Slice = require( '@stdlib/slice/ctor' );
+var MultiSlice = require( '@stdlib/slice/multi' );
+var scalar2ndarray = require( '@stdlib/ndarray/base/from-scalar' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var array = require( '@stdlib/ndarray/array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var toFilledSlice = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof toFilledSlice, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray (multislice)', 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() {
+ toFilledSlice( value, 10.0, new MultiSlice( null, null ) );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray (array)', 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() {
+ toFilledSlice( value, 10.0, [] );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray (slice arguments)', 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() {
+ toFilledSlice( value, 10.0, null, null );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which cannot be safely cast to the input ndarray data type', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = ndzeros( [ 2, 2 ], {
+ 'dtype': 'int32'
+ });
+
+ values = [
+ '5',
+ 3.14,
+ 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() {
+ toFilledSlice( x, value, new MultiSlice( null, null ) );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `strict` option which is not a boolean', function test( t ) {
+ var values;
+ var x;
+ var s;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ x = ndzeros( [ 2 ], {
+ 'dtype': 'float64'
+ });
+ s = new MultiSlice( null );
+
+ 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() {
+ toFilledSlice( x, 10.0, s, {
+ 'strict': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid slice argument (separate slice arguments)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ values = [
+ '5',
+ NaN,
+ [],
+ function noop() {}
+ ];
+ x = ndzeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ 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() {
+ toFilledSlice( x, 10.0, null, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if the number of slice dimensions does not match the number of input array dimensions (multislice)', function test( t ) {
+ var slices;
+ var x;
+ var i;
+
+ x = ndzeros( [ 2, 2 ] );
+
+ slices = [
+ new MultiSlice( null ),
+ new MultiSlice( null, null, null ),
+ new MultiSlice( null, null, null, null )
+ ];
+ for ( i = 0; i < slices.length; i++ ) {
+ t.throws( badValues( slices[ i ] ), RangeError, 'throws an error when provided ' + slices[ i ].toString() );
+ }
+ t.end();
+
+ function badValues( s ) {
+ return function badValues() {
+ toFilledSlice( x, 10.0, s );
+ };
+ }
+});
+
+tape( 'the function throws an error if the number of slice dimensions does not match the number of input array dimensions (array)', function test( t ) {
+ var slices;
+ var x;
+ var i;
+
+ x = ndzeros( [ 2, 2 ] );
+
+ slices = [
+ [ null ],
+ [ null, null, null ],
+ [ null, null, null, null ]
+ ];
+ for ( i = 0; i < slices.length; i++ ) {
+ t.throws( badValues( slices[ i ] ), RangeError, 'throws an error when provided ' + slices[ i ].toString() );
+ }
+ t.end();
+
+ function badValues( s ) {
+ return function badValues() {
+ toFilledSlice( x, 10.0, s );
+ };
+ }
+});
+
+tape( 'the function throws an error if the number of slice dimensions does not match the number of input array dimensions (no slice arguments, options)', function test( t ) {
+ var x = ndzeros( [ 2, 2 ] );
+
+ t.throws( badValue, RangeError, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ toFilledSlice( x, 10.0, {} );
+ }
+});
+
+tape( 'the function throws an error when a slice exceeds output array bounds', function test( t ) {
+ var slices;
+ var x;
+ var s;
+ var i;
+
+ x = ndzeros( [ 2, 2 ] );
+
+ s = new Slice( 10, 20, 1 );
+ slices = [
+ new MultiSlice( 10, 0 ),
+ new MultiSlice( null, s ),
+ new MultiSlice( s, null ),
+ new MultiSlice( s, s )
+ ];
+ for ( i = 0; i < slices.length; i++ ) {
+ t.throws( badValues( slices[ i ] ), RangeError, 'throws an error when provided ' + slices[ i ].toString() );
+ }
+ t.end();
+
+ function badValues( s ) {
+ return function badValues() {
+ toFilledSlice( x, 10.0, s );
+ };
+ }
+});
+
+tape( 'the function throws an error if a slice has a non-unit absolute index increment', function test( t ) {
+ var slices;
+ var x;
+ var i;
+
+ x = ndzeros( [ 4, 4 ] );
+
+ slices = [
+ new MultiSlice( new Slice( 0, 4, 2 ), null ),
+ new MultiSlice( null, new Slice( 0, 4, 2 ) ),
+ new MultiSlice( new Slice( 0, 4, -1 ), null )
+ ];
+ for ( i = 0; i < slices.length; i++ ) {
+ t.throws( badValues( slices[ i ] ), RangeError, 'throws an error when provided ' + slices[ i ].toString() );
+ }
+ t.end();
+
+ function badValues( s ) {
+ return function badValues() {
+ toFilledSlice( x, 10.0, s );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided too many arguments (multislice)', function test( t ) {
+ var s = new MultiSlice( null, null );
+ var x = ndzeros( [ 2, 2 ] );
+
+ t.throws( badValue, Error, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ toFilledSlice( x, 10.0, s, s );
+ }
+});
+
+tape( 'the function throws an error if provided too many arguments (array)', function test( t ) {
+ var x = ndzeros( [ 2, 2 ] );
+
+ t.throws( badValue, Error, 'throws an error' );
+ t.end();
+
+ function badValue() {
+ toFilledSlice( x, 10.0, [ null, null ], null );
+ }
+});
+
+tape( 'the function returns a new ndarray', function test( t ) {
+ var actual;
+ var before;
+ var after;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ]);
+ before = ndarray2array( x );
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, 0.0, s );
+ after = ndarray2array( x );
+
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns a writable ndarray' );
+ t.deepEqual( before, after, 'does not mutate input' );
+ t.deepEqual( ndarray2array( actual ), [ [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0 ] ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function preserves the input ndarray data type, shape, and order', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = ndzeros( [ 3, 4 ], {
+ 'dtype': 'float32',
+ 'order': 'column-major'
+ });
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, 1.0, s );
+
+ t.strictEqual( getDType( actual ), 'float32', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 3, 4 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), 'column-major', 'returns expected value' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns a writable ndarray' );
+ t.end();
+});
+
+tape( 'the function supports a read-only input ndarray', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = ndzeros( [ 2, 2 ], {
+ 'dtype': 'float64',
+ 'readonly': true
+ });
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, 10.0, s );
+
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns a writable ndarray' );
+ t.deepEqual( ndarray2array( actual ), [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ], 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a copy of the input ndarray when provided an empty fill region', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ]);
+
+ // An empty slice along any dimension produces an empty fill region; the function should still return a full copy of the input:
+ s = new MultiSlice( new Slice( 1, 1 ), new Slice( 2, 4 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ];
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns a writable ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns a full copy of the input ndarray' );
+ t.end();
+});
+
+tape( 'the function does not set element values when a slice exceeds output array bounds', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0 ],
+ [ 3.0, 4.0 ]
+ ]);
+ expected = [
+ [ 1.0, 2.0 ],
+ [ 3.0, 4.0 ]
+ ];
+ s = new Slice( 10, 20, 1 );
+
+ actual = toFilledSlice( x, 10.0, new MultiSlice( 10, 0 ), {
+ 'strict': false
+ });
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns input contents when slice is out-of-bounds' );
+
+ actual = toFilledSlice( x, 10.0, new MultiSlice( null, s ), {
+ 'strict': false
+ });
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns input contents when slice is out-of-bounds' );
+
+ actual = toFilledSlice( x, 10.0, new MultiSlice( s, null ), {
+ 'strict': false
+ });
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns input contents when slice is out-of-bounds' );
+
+ actual = toFilledSlice( x, 10.0, new MultiSlice( s, s ), {
+ 'strict': false
+ });
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns input contents when slice is out-of-bounds' );
+
+ t.end();
+});
+
+tape( 'the function returns a copy of the input ndarray when an out-of-bounds slice clamps to an empty fill region (non-strict mode)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ]
+ ]);
+ expected = [
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ]
+ ];
+
+ // `Slice( 10, 20, 1 )` is fully out-of-bounds; in non-strict mode `normalizeMultiSlice` clamps it to `start === stop`, which engages the empty-region fast path:
+ s = new MultiSlice( null, new Slice( 10, 20, 1 ) );
+
+ actual = toFilledSlice( x, 0.0, s, {
+ 'strict': false
+ });
+
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( isReadOnly( actual ), false, 'returns a writable ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns a full copy of the input ndarray' );
+ t.end();
+});
+
+tape( 'the function supports filling a zero-dimensional array (multislice)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = scalar2ndarray( 3.14, 'float64', 'row-major' );
+ s = new MultiSlice();
+
+ actual = toFilledSlice( x, 10.0, s );
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( actual.get(), 10.0, 'returns expected value' );
+ t.strictEqual( x.get(), 3.14, 'does not mutate input' );
+
+ t.end();
+});
+
+tape( 'the function supports filling a zero-dimensional array (array)', function test( t ) {
+ var actual;
+ var x;
+
+ x = scalar2ndarray( 3.14, 'float64', 'row-major' );
+
+ actual = toFilledSlice( x, 10.0, [] );
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( actual.get(), 10.0, 'returns expected value' );
+ t.strictEqual( x.get(), 3.14, 'does not mutate input' );
+
+ t.end();
+});
+
+tape( 'the function supports filling a zero-dimensional array (no slice arguments)', function test( t ) {
+ var actual;
+ var x;
+
+ x = scalar2ndarray( 3.14, 'float64', 'row-major' );
+
+ actual = toFilledSlice( x, 10.0 );
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.strictEqual( actual.get(), 10.0, 'returns expected value' );
+ t.strictEqual( x.get(), 3.14, 'does not mutate input' );
+
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, single cell)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0 ],
+ [ 3.0, 4.0 ]
+ ]);
+ s = new MultiSlice( 0, 1 );
+
+ actual = toFilledSlice( x, 10.0, s );
+
+ expected = [
+ [ 1.0, 10.0 ],
+ [ 3.0, 4.0 ]
+ ];
+ t.notStrictEqual( actual, x, 'returns a new ndarray' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ], 'does not mutate input' );
+
+ t.end();
+});
+
+tape( 'the function fills a slice region (1d, full extent)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+ s = new MultiSlice( null );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ t.deepEqual( ndarray2array( actual ), [ 0.0, 0.0, 0.0, 0.0 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ 1.0, 2.0, 3.0, 4.0 ], 'does not mutate input' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (1d, prefix)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+ s = new MultiSlice( new Slice( 0, 2 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ t.deepEqual( ndarray2array( actual ), [ 0.0, 0.0, 3.0, 4.0 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ 1.0, 2.0, 3.0, 4.0 ], 'does not mutate input' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (1d, suffix)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+ s = new MultiSlice( new Slice( 2, 4 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ t.deepEqual( ndarray2array( actual ), [ 1.0, 2.0, 0.0, 0.0 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ 1.0, 2.0, 3.0, 4.0 ], 'does not mutate input' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (1d, interior)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
+ s = new MultiSlice( new Slice( 1, 4 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ t.deepEqual( ndarray2array( actual ), [ 1.0, 0.0, 0.0, 0.0, 5.0 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ 1.0, 2.0, 3.0, 4.0, 5.0 ], 'does not mutate input' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (1d, single cell)', function test( t ) {
+ var actual;
+ var x;
+ var s;
+
+ x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+ s = new MultiSlice( 2 );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ t.deepEqual( ndarray2array( actual ), [ 1.0, 2.0, 0.0, 4.0 ], 'returns expected value' );
+ t.deepEqual( ndarray2array( x ), [ 1.0, 2.0, 3.0, 4.0 ], 'does not mutate input' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, corner)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ]);
+ s = new MultiSlice( new Slice( 0, 2 ), new Slice( 0, 2 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 0.0, 0.0, 3.0, 4.0 ],
+ [ 0.0, 0.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, edge)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ]);
+ s = new MultiSlice( null, new Slice( 2, 4 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 1.0, 2.0, 0.0, 0.0 ],
+ [ 5.0, 6.0, 0.0, 0.0 ],
+ [ 9.0, 10.0, 0.0, 0.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, interior)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ]);
+ s = new MultiSlice( new Slice( 1, 2 ), new Slice( 1, 3 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 0.0, 0.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, full extent)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0 ],
+ [ 3.0, 4.0 ]
+ ]);
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 0.0, 0.0 ],
+ [ 0.0, 0.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (3d, interior)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ],
+ [
+ [ 7.0, 8.0, 9.0 ],
+ [ 10.0, 11.0, 12.0 ]
+ ],
+ [
+ [ 13.0, 14.0, 15.0 ],
+ [ 16.0, 17.0, 18.0 ]
+ ]
+ ]);
+ s = new MultiSlice( new Slice( 1, 2 ), new Slice( 0, 1 ), new Slice( 1, 3 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ],
+ [
+ [ 7.0, 0.0, 0.0 ],
+ [ 10.0, 11.0, 12.0 ]
+ ],
+ [
+ [ 13.0, 14.0, 15.0 ],
+ [ 16.0, 17.0, 18.0 ]
+ ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (separate slice arguments)', function test( t ) {
+ var expected;
+ var actual;
+ var s0;
+ var s1;
+ var x;
+
+ x = array([
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ]);
+ s0 = new Slice( 0, 1 );
+ s1 = new Slice( 1, 3 );
+
+ actual = toFilledSlice( x, 0.0, s0, s1 );
+
+ expected = [
+ [ 1.0, 0.0, 0.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (array of slices)', function test( t ) {
+ var expected;
+ var actual;
+ var s0;
+ var s1;
+ var x;
+
+ x = array([
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ]);
+ s0 = new Slice( 0, 1 );
+ s1 = new Slice( 1, 3 );
+
+ actual = toFilledSlice( x, 0.0, [ s0, s1 ] );
+
+ expected = [
+ [ 1.0, 0.0, 0.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, corner, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = ndzeros( [ 3, 4 ], {
+ 'dtype': 'float64',
+ 'order': 'column-major'
+ });
+ s = new MultiSlice( new Slice( 1, 3 ), new Slice( 2, 4 ) );
+
+ actual = toFilledSlice( x, 5.0, s );
+
+ expected = [
+ [ 0.0, 0.0, 0.0, 0.0 ],
+ [ 0.0, 0.0, 5.0, 5.0 ],
+ [ 0.0, 0.0, 5.0, 5.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( getOrder( actual ), 'column-major', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (2d, interior, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 6.0, 7.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ], {
+ 'order': 'column-major'
+ });
+ s = new MultiSlice( new Slice( 1, 2 ), new Slice( 1, 3 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [ 1.0, 2.0, 3.0, 4.0 ],
+ [ 5.0, 0.0, 0.0, 8.0 ],
+ [ 9.0, 10.0, 11.0, 12.0 ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( getOrder( actual ), 'column-major', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (3d, interior, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+ var s;
+
+ x = array([
+ [
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ],
+ [
+ [ 7.0, 8.0, 9.0 ],
+ [ 10.0, 11.0, 12.0 ]
+ ],
+ [
+ [ 13.0, 14.0, 15.0 ],
+ [ 16.0, 17.0, 18.0 ]
+ ]
+ ], {
+ 'order': 'column-major'
+ });
+ s = new MultiSlice( new Slice( 1, 2 ), new Slice( 0, 1 ), new Slice( 1, 3 ) );
+
+ actual = toFilledSlice( x, 0.0, s );
+
+ expected = [
+ [
+ [ 1.0, 2.0, 3.0 ],
+ [ 4.0, 5.0, 6.0 ]
+ ],
+ [
+ [ 7.0, 0.0, 0.0 ],
+ [ 10.0, 11.0, 12.0 ]
+ ],
+ [
+ [ 13.0, 14.0, 15.0 ],
+ [ 16.0, 17.0, 18.0 ]
+ ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( getOrder( actual ), 'column-major', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (non-contiguous input view, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var ord;
+ var dt;
+ var sh;
+ var st;
+ var o;
+ var s;
+ var x;
+
+ dt = 'float64';
+ ord = 'row-major';
+ sh = [ 3, 1, 2 ];
+ st = [ 4, 4, 1 ];
+ o = 1;
+
+ x = ndarray( dt, [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], sh, st, o, ord );
+ s = new MultiSlice( new Slice( 0, 2 ), null, null );
+
+ actual = toFilledSlice( x, 100.0, s );
+
+ expected = [
+ [
+ [ 100.0, 100.0 ]
+ ],
+ [
+ [ 100.0, 100.0 ]
+ ],
+ [
+ [ 9.0, 10.0 ]
+ ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function fills a slice region (non-contiguous input view, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var ord;
+ var dt;
+ var sh;
+ var st;
+ var o;
+ var s;
+ var x;
+
+ dt = 'float64';
+ ord = 'column-major';
+ sh = [ 3, 1, 2 ];
+ st = [ 1, 3, 6 ];
+ o = 0;
+
+ x = ndarray( dt, [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ], sh, st, o, ord );
+ s = new MultiSlice( new Slice( 0, 2 ), null, null );
+
+ actual = toFilledSlice( x, 100.0, s );
+
+ expected = [
+ [
+ [ 100.0, 100.0 ]
+ ],
+ [
+ [ 100.0, 100.0 ]
+ ],
+ [
+ [ 2.0, 8.0 ]
+ ]
+ ];
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( getOrder( actual ), 'column-major', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports complex-typed input ndarrays', function test( t ) {
+ var actual;
+ var arr;
+ var x;
+ var s;
+ var v;
+
+ x = ndzeros( [ 2, 2 ], {
+ 'dtype': 'complex128'
+ });
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, new Complex128( 10.0, 20.0 ), s );
+
+ arr = ndarray2array( actual );
+
+ v = arr[ 0 ][ 0 ];
+ t.strictEqual( real( v ), 10.0, 'returns expected real component' );
+ t.strictEqual( imag( v ), 20.0, 'returns expected imaginary component' );
+
+ v = arr[ 1 ][ 1 ];
+ t.strictEqual( real( v ), 10.0, 'returns expected real component' );
+ t.strictEqual( imag( v ), 20.0, 'returns expected imaginary component' );
+
+ t.end();
+});
+
+tape( 'the function supports filling a complex-typed input ndarray with a real-valued fill value', function test( t ) {
+ var actual;
+ var arr;
+ var x;
+ var s;
+ var v;
+
+ x = ndzeros( [ 2, 2 ], {
+ 'dtype': 'complex128'
+ });
+ s = new MultiSlice( null, null );
+
+ actual = toFilledSlice( x, 10.0, s );
+
+ arr = ndarray2array( actual );
+
+ v = arr[ 0 ][ 0 ];
+ t.strictEqual( real( v ), 10.0, 'returns expected real component' );
+ t.strictEqual( imag( v ), 0.0, 'returns expected imaginary component' );
+
+ t.end();
+});