From d0942d8709df8080d816b6299e81f08aefbc06aa Mon Sep 17 00:00:00 2001 From: Samarth Kolarkar Date: Fri, 25 Sep 2026 09:18:47 +0530 Subject: [PATCH 1/2] feat: add float16 dtype support to ndarray/base/slice-dimension --- .../slice-dimension/benchmark/benchmark.js | 30 ++++++++++++ .../slice-dimension/docs/types/index.d.ts | 46 ++++++++++++++++++- .../base/slice-dimension/docs/types/test.ts | 2 + .../ndarray/base/slice-dimension/test/test.js | 14 ++++++ 4 files changed, 91 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/benchmark/benchmark.js index ff9a97ec3b0b..73d0f2d5aa42 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/benchmark/benchmark.js @@ -41,6 +41,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' ) @@ -73,6 +74,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' } ) @@ -106,6 +108,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' ) @@ -138,6 +141,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' } ) @@ -171,6 +175,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' ) @@ -203,6 +208,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' } ) @@ -236,6 +242,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' ) @@ -268,6 +275,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' } ) @@ -301,6 +309,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' ) @@ -333,6 +342,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' } ) @@ -366,6 +376,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' ) @@ -398,6 +409,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' } ) @@ -431,6 +443,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' ) @@ -463,6 +476,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' } ) @@ -496,6 +510,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' ) @@ -528,6 +543,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' } ) @@ -561,6 +577,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' ) @@ -593,6 +610,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' } ) @@ -626,6 +644,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' ) @@ -658,6 +677,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' } ) @@ -691,6 +711,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' ) @@ -723,6 +744,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' } ) @@ -756,6 +778,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' ) @@ -788,6 +811,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' } ) @@ -821,6 +845,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' ) @@ -853,6 +878,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' } ) @@ -886,6 +912,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' ) @@ -918,6 +945,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' } ) @@ -951,6 +979,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' ) @@ -983,6 +1012,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-dimension/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/index.d.ts index 96fbebf2f12d..cd142e9610b9 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/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 { Slice } from '@stdlib/types/slice'; /** @@ -111,6 +111,50 @@ declare function sliceDimension( x: float64ndarray, dim: number, s: Slice | numb */ declare function sliceDimension( x: float32ndarray, dim: number, s: Slice | number, strict: boolean, writable: boolean ): float32ndarray; +/** +* Returns a view of an input ndarray when sliced along a specified dimension. +* +* @param x - input array +* @param dim - index of dimension to slice +* @param s - slice object or an integer +* @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 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 Slice( null, null, -1 ); +* // returns +* +* var y = sliceDimension( x, 0, s, false, false ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* arr = ndarray2array( y ); +* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ] +*/ +declare function sliceDimension( x: float16ndarray, dim: number, s: Slice | number, strict: boolean, writable: boolean ): float16ndarray; + /** * Returns a view of an input ndarray when sliced along a specified dimension. * diff --git a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/test.ts index b744af57603f..9d6761a89e34 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/test.ts +++ b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/docs/types/test.ts @@ -31,6 +31,7 @@ import sliceDimension = require( './index' ); sliceDimension( empty( 'float64', sh, order ), 1, s, false, false ); // $ExpectType float64ndarray sliceDimension( empty( 'float32', sh, order ), 1, s, false, false ); // $ExpectType float32ndarray + sliceDimension( empty( 'float16', sh, order ), 1, s, false, false ); // $ExpectType float16ndarray sliceDimension( empty( 'complex128', sh, order ), 1, s, false, false ); // $ExpectType complex128ndarray sliceDimension( empty( 'complex64', sh, order ), 1, s, false, false ); // $ExpectType complex64ndarray sliceDimension( empty( 'int32', sh, order ), 1, s, false, false ); // $ExpectType int32ndarray @@ -43,6 +44,7 @@ import sliceDimension = require( './index' ); sliceDimension( empty( 'float64', sh, order ), 1, s, true, true ); // $ExpectType float64ndarray sliceDimension( empty( 'float32', sh, order ), 1, s, true, true ); // $ExpectType float32ndarray + sliceDimension( empty( 'float16', sh, order ), 1, s, true, true ); // $ExpectType float16ndarray sliceDimension( empty( 'complex128', sh, order ), 1, s, true, true ); // $ExpectType complex128ndarray sliceDimension( empty( 'complex64', sh, order ), 1, s, true, true ); // $ExpectType complex64ndarray sliceDimension( empty( 'int32', sh, order ), 1, s, true, true ); // $ExpectType int32ndarray diff --git a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js index f7edea288854..442b86997e40 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js @@ -167,6 +167,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' } ) @@ -175,6 +176,7 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce slices = [ new Slice( 5, 20, 1 ), 10, + 10, new Slice( 7, 8, 1 ), 20, new Slice( -25, -50, -1 ) @@ -206,6 +208,10 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar 'shape': [ 8 ], 'dtype': 'float32' }), + array( typedarray( zeroTo( 8 ), 'float16' ), { + 'shape': [ 8 ], + 'dtype': 'float16' + }), array( typedarray( zeroTo( 2 ), 'int32' ), { 'shape': [ 2 ], 'dtype': 'int32' @@ -218,12 +224,14 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar slices = [ 2, 3, + 3, 1, 8 ]; expected = [ 2, 3, + 3, 1, 8 ]; @@ -259,6 +267,10 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar 'shape': [ 8 ], 'dtype': 'float32' }), + array( typedarray( zeroTo( 8 ), 'float16' ), { + 'shape': [ 8 ], + 'dtype': 'float16' + }), array( typedarray( zeroTo( 2 ), 'int32' ), { 'shape': [ 2 ], 'dtype': 'int32' @@ -271,12 +283,14 @@ tape( 'if all dimensions are reduced, the function returns a zero-dimensional ar slices = [ 2, 3, + 3, 1, 8 ]; expected = [ 2, 3, + 3, 1, 8 ]; From 8451f827411c1d1b23b84ab7c9f3f612656b5e67 Mon Sep 17 00:00:00 2001 From: Samarth Kolarkar Date: Fri, 25 Sep 2026 14:31:13 +0530 Subject: [PATCH 2/2] chore: fix JavaScript lint errors in test.js --- .../@stdlib/ndarray/base/slice-dimension/test/test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js index 442b86997e40..7b9d2e021b1f 100644 --- a/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/base/slice-dimension/test/test.js @@ -164,6 +164,8 @@ tape( 'in non-strict mode, the function returns an empty array when a slice exce var slices; var i; + /* eslint-disable stdlib/line-closing-bracket-spacing */ + values = [ zeros( [ 1 ], { 'dtype': 'float64' } ), zeros( [ 1, 1 ], { 'dtype': 'float32' } ), @@ -173,6 +175,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 */ + slices = [ new Slice( 5, 20, 1 ), 10,