From ba471a195b709e85e0bff65b870466ff3f7232aa Mon Sep 17 00:00:00 2001 From: Samarth Kolarkar Date: Fri, 25 Sep 2026 07:58:23 +0530 Subject: [PATCH 1/2] feat: add float16 dtype support to ndarray/base/slice --- .../ndarray/base/slice/benchmark/benchmark.js | 32 +++++++++++++ .../ndarray/base/slice/docs/types/index.d.ts | 46 ++++++++++++++++++- .../ndarray/base/slice/docs/types/test.ts | 2 + .../@stdlib/ndarray/base/slice/test/test.js | 14 ++++++ 4 files changed, 93 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/slice/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/base/slice/benchmark/benchmark.js index 19ebed1a4b0b..61754d89588e 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice/benchmark/benchmark.js @@ -42,6 +42,7 @@ bench( format( '%s::0d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [], 'row-major' ), baseEmpty( 'float32', [], 'row-major' ), + baseEmpty( 'float16', [], 'row-major' ), baseEmpty( 'int32', [], 'row-major' ), baseEmpty( 'complex128', [], 'row-major' ), baseEmpty( 'generic', [], 'row-major' ) @@ -74,6 +75,7 @@ bench( format( '%s::0d,non-base', pkg ), function benchmark( b ) { values = [ empty( [], { 'dtype': 'float64' } ), empty( [], { 'dtype': 'float32' } ), + empty( [], { 'dtype': 'float16' } ), empty( [], { 'dtype': 'int32' } ), empty( [], { 'dtype': 'complex128' } ), empty( [], { 'dtype': 'generic' } ) @@ -107,6 +109,7 @@ bench( format( '%s::1d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2 ], 'row-major' ), baseEmpty( 'float32', [ 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2 ], 'row-major' ), baseEmpty( 'int32', [ 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2 ], 'row-major' ), baseEmpty( 'generic', [ 2 ], 'row-major' ) @@ -139,6 +142,7 @@ bench( format( '%s::1d,non-base', pkg ), function benchmark( b ) { values = [ empty( [ 2 ], { 'dtype': 'float64' } ), empty( [ 2 ], { 'dtype': 'float32' } ), + empty( [ 2 ], { 'dtype': 'float16' } ), empty( [ 2 ], { 'dtype': 'int32' } ), empty( [ 2 ], { 'dtype': 'complex128' } ), empty( [ 2 ], { 'dtype': 'generic' } ) @@ -172,6 +176,7 @@ bench( format( '%s::1d,base,reduced', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2 ], 'row-major' ), baseEmpty( 'float32', [ 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2 ], 'row-major' ), baseEmpty( 'int32', [ 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2 ], 'row-major' ), baseEmpty( 'generic', [ 2 ], 'row-major' ) @@ -204,6 +209,7 @@ bench( format( '%s::1d,non-base,reduced', pkg ), function benchmark( b ) { values = [ empty( [ 2 ], { 'dtype': 'float64' } ), empty( [ 2 ], { 'dtype': 'float32' } ), + empty( [ 2 ], { 'dtype': 'float16' } ), empty( [ 2 ], { 'dtype': 'int32' } ), empty( [ 2 ], { 'dtype': 'complex128' } ), empty( [ 2 ], { 'dtype': 'generic' } ) @@ -237,6 +243,7 @@ bench( format( '%s::1d,base,out-of-bounds', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2 ], 'row-major' ), baseEmpty( 'float32', [ 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2 ], 'row-major' ), baseEmpty( 'int32', [ 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2 ], 'row-major' ), baseEmpty( 'generic', [ 2 ], 'row-major' ) @@ -269,6 +276,7 @@ bench( format( '%s::1d,non-base,out-of-bounds', pkg ), function benchmark( b ) { values = [ empty( [ 2 ], { 'dtype': 'float64' } ), empty( [ 2 ], { 'dtype': 'float32' } ), + empty( [ 2 ], { 'dtype': 'float16' } ), empty( [ 2 ], { 'dtype': 'int32' } ), empty( [ 2 ], { 'dtype': 'complex128' } ), empty( [ 2 ], { 'dtype': 'generic' } ) @@ -302,6 +310,7 @@ bench( format( '%s::2d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2 ], 'row-major' ) @@ -334,6 +343,7 @@ bench( format( '%s::2d,non-base', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2 ], { 'dtype': 'generic' } ) @@ -367,6 +377,7 @@ bench( format( '%s::2d,base,reduced', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2 ], 'row-major' ) @@ -399,6 +410,7 @@ bench( format( '%s::2d,non-base,reduced', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2 ], { 'dtype': 'generic' } ) @@ -432,6 +444,7 @@ bench( format( '%s::2d,base,out-of-bounds', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2 ], 'row-major' ) @@ -464,6 +477,7 @@ bench( format( '%s::2d,non-base,out-of-bounds', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2 ], { 'dtype': 'generic' } ) @@ -497,6 +511,7 @@ bench( format( '%s::3d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' ) @@ -529,6 +544,7 @@ bench( format( '%s::3d,non-base', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -562,6 +578,7 @@ bench( format( '%s::3d,base,reduced', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' ) @@ -594,6 +611,7 @@ bench( format( '%s::3d,non-base,reduced', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -627,6 +645,7 @@ bench( format( '%s::3d,base,out-of-bounds', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' ) @@ -659,6 +678,7 @@ bench( format( '%s::3d,non-base,out-of-bounds', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -692,6 +712,7 @@ bench( format( '%s::4d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' ) @@ -724,6 +745,7 @@ bench( format( '%s::4d,non-base', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -757,6 +779,7 @@ bench( format( '%s::4d,base,reduced', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' ) @@ -789,6 +812,7 @@ bench( format( '%s::4d,non-base,reduced', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -822,6 +846,7 @@ bench( format( '%s::4d,base,out-of-bounds', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' ) @@ -854,6 +879,7 @@ bench( format( '%s::4d,non-base,out-of-bounds', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -887,6 +913,7 @@ bench( format( '%s::5d,base', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' ) @@ -919,6 +946,7 @@ bench( format( '%s::5d,non-base', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -952,6 +980,7 @@ bench( format( '%s::5d,base,reduced', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' ) @@ -984,6 +1013,7 @@ bench( format( '%s::5d,non-base,reduced', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } ) @@ -1017,6 +1047,7 @@ bench( format( '%s::5d,base,out-of-bounds', pkg ), function benchmark( b ) { values = [ baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ), + baseEmpty( 'float16', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ), baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' ) @@ -1049,6 +1080,7 @@ bench( format( '%s::5d,non-base,out-of-bounds', pkg ), function benchmark( b ) { values = [ empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ), + empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float16' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ), empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } ) diff --git a/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/index.d.ts index a5ab64dec11f..dece62d5b9bf 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; +import { typedndarray, genericndarray, float64ndarray, float32ndarray, float16ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; import { MultiSlice } from '@stdlib/types/slice'; /** @@ -111,6 +111,50 @@ declare function slice( x: float64ndarray, s: MultiSlice, strict: boolean, writa */ declare function slice( x: float32ndarray, s: MultiSlice, strict: boolean, writable: boolean ): float32ndarray; +/** +* Returns a view of an input ndarray. +* +* @param x - input array +* @param s - multi-slice object +* @param strict - boolean indicating whether to enforce strict bounds checking +* @param writable - boolean indicating whether a returned array should be writable +* @returns output array +* +* @example +* var Slice = require( '@stdlib/slice/ctor' ); +* var MultiSlice = require( '@stdlib/slice/multi' ); +* var typedarray = require( '@stdlib/array/typed' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* +* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float16' ); +* var shape = [ 3, 2 ]; +* var strides = [ 2, 1 ]; +* var offset = 0; +* +* var x = ndarray( 'float16', buffer, shape, strides, offset, 'row-major' ); +* // returns +* +* var sh = x.shape; +* // returns [ 3, 2 ] +* +* var arr = ndarray2array( x ); +* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ] +* +* var s = new MultiSlice( new Slice( null, null, -2 ), new Slice( null, null, -1 ) ); +* // returns +* +* var y = slice( x, s, false, false ); +* // returns +* +* sh = y.shape; +* // returns [ 2, 2 ] +* +* arr = ndarray2array( y ); +* // returns [ [ 6.0, 5.0 ], [ 2.0, 1.0 ] ] +*/ +declare function slice( x: float16ndarray, s: MultiSlice, strict: boolean, writable: boolean ): float16ndarray; + /** * Returns a view of an input ndarray. * diff --git a/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/test.ts index 3300517d65b6..7810607e2a26 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/test.ts +++ b/lib/node_modules/@stdlib/ndarray/base/slice/docs/types/test.ts @@ -31,6 +31,7 @@ import slice = require( './index' ); slice( empty( 'float64', sh, order ), s, false, false ); // $ExpectType float64ndarray slice( empty( 'float32', sh, order ), s, false, false ); // $ExpectType float32ndarray + slice( empty( 'float16', sh, order ), s, false, false ); // $ExpectType float16ndarray slice( empty( 'complex128', sh, order ), s, false, false ); // $ExpectType complex128ndarray slice( empty( 'complex64', sh, order ), s, false, false ); // $ExpectType complex64ndarray slice( empty( 'int32', sh, order ), s, false, false ); // $ExpectType int32ndarray @@ -43,6 +44,7 @@ import slice = require( './index' ); slice( empty( 'float64', sh, order ), s, true, true ); // $ExpectType float64ndarray slice( empty( 'float32', sh, order ), s, true, true ); // $ExpectType float32ndarray + slice( empty( 'float16', sh, order ), s, true, true ); // $ExpectType float16ndarray slice( empty( 'complex128', sh, order ), s, true, true ); // $ExpectType complex128ndarray slice( empty( 'complex64', sh, order ), s, true, true ); // $ExpectType complex64ndarray slice( empty( 'int32', sh, order ), s, true, true ); // $ExpectType int32ndarray diff --git a/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js b/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js index 94a42f97cd25..6c40948f5a5c 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js @@ -151,6 +151,7 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce values = [ zeros( [ 1 ], { 'dtype': 'float64' } ), zeros( [ 1, 1 ], { 'dtype': 'float32' } ), + zeros( [ 1, 1 ], { 'dtype': 'float16' } ), zeros( [ 1, 1, 1 ], { 'dtype': 'int32' } ), zeros( [ 1, 1, 1, 1 ], { 'dtype': 'uint32' } ), zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } ) @@ -160,6 +161,7 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce slices = [ new MultiSlice( 10 ), new MultiSlice( null, s ), + new MultiSlice( null, s ), new MultiSlice( s, null, null ), new MultiSlice( s, s, null, null ), new MultiSlice( 0, null, null, null, 10 ) @@ -265,6 +267,10 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar 'shape': [ 2, 2, 2 ], 'dtype': 'float32' }), + array( typedarray( zeroTo( 8 ), 'float16' ), { + 'shape': [ 2, 2, 2 ], + 'dtype': 'float16' + }), array( typedarray( zeroTo( 2 ), 'int32' ), { 'shape': [ 2 ], 'dtype': 'int32' @@ -277,12 +283,14 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar slices = [ new MultiSlice( 0, 1 ), new MultiSlice( 0, 1, 0 ), + new MultiSlice( 0, 1, 0 ), new MultiSlice( 0 ), new MultiSlice( 0, 1, 0, 1 ) ]; expected = [ 1, 2, + 2, 0, 5 ]; @@ -318,6 +326,10 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar 'shape': [ 2, 2, 2 ], 'dtype': 'float32' }), + array( typedarray( zeroTo( 8 ), 'float16' ), { + 'shape': [ 2, 2, 2 ], + 'dtype': 'float16' + }), array( typedarray( zeroTo( 2 ), 'int32' ), { 'shape': [ 2 ], 'dtype': 'int32' @@ -330,12 +342,14 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar slices = [ new MultiSlice( 0, 1 ), new MultiSlice( 0, 1, 0 ), + new MultiSlice( 0, 1, 0 ), new MultiSlice( 0 ), new MultiSlice( 0, 1, 0, 1 ) ]; expected = [ 1, 2, + 2, 0, 5 ]; From d639c31e540ce1745e08270e94be03335d50306c Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 24 Sep 2026 20:02:48 -0700 Subject: [PATCH 2/2] style: disable lint rule Signed-off-by: Athan --- lib/node_modules/@stdlib/ndarray/base/slice/test/test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js b/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js index 6c40948f5a5c..d4250aad3a77 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice/test/test.js @@ -148,6 +148,8 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce var s; var i; + /* eslint-disable stdlib/line-closing-bracket-spacing */ + values = [ zeros( [ 1 ], { 'dtype': 'float64' } ), zeros( [ 1, 1 ], { 'dtype': 'float32' } ), @@ -157,6 +159,8 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } ) ]; + /* eslint-enable stdlib/line-closing-bracket-spacing */ + s = new Slice( 10, 20, 1 ); slices = [ new MultiSlice( 10 ),