diff --git a/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.call_signatures.js b/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.call_signatures.js index 91d0069cfbab..3a6d638e17cb 100644 --- a/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.call_signatures.js +++ b/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.call_signatures.js @@ -38,6 +38,7 @@ bench( format( '%s::2d,base,separate_arguments', 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' ) @@ -66,6 +67,7 @@ bench( format( '%s::2d,base,array', 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' ) diff --git a/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.js index a63934ace86e..72cb486911ff 100644 --- a/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/ndarray/slice-to/benchmark/benchmark.js @@ -40,6 +40,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' ) @@ -72,6 +73,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' } ) @@ -105,6 +107,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' ) @@ -137,6 +140,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' } ) @@ -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' ) @@ -207,6 +212,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' } ) @@ -243,6 +249,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' ) @@ -275,6 +282,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' } ) @@ -309,6 +317,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' ) @@ -345,6 +354,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' } ) @@ -381,6 +391,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' ) @@ -413,6 +424,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' } ) @@ -447,6 +459,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' ) @@ -483,6 +496,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' } ) @@ -519,6 +533,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' ) @@ -551,6 +566,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' } ) @@ -585,6 +601,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' ) @@ -621,6 +638,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' } ) @@ -657,6 +675,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' ) @@ -689,6 +708,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' } ) @@ -723,6 +743,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' ) @@ -759,6 +780,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/slice-to/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/index.d.ts index 4a2de4a5204a..d6130a26ffb3 100644 --- a/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/index.d.ts @@ -22,7 +22,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 { ArrayLike } from '@stdlib/types/array'; /** @@ -203,6 +203,85 @@ declare function sliceTo( x: float32ndarray, stop: ArrayLike, opti */ declare function sliceTo( x: float32ndarray, ...stop: Array ): float32ndarray; +/** +* Returns a read-only truncated view of an input ndarray. +* +* @param x - input array +* @param stop - ending indices (exclusive) +* @param options - function options +* @param options.strict - boolean indicating whether to enforce strict bounds checking +* @returns output array +* +* @example +* 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 = [ 2, null ]; +* var y = sliceTo( x, s ); +* // returns +* +* sh = y.shape; +* // returns [ 2, 2 ] +* +* arr = ndarray2array( y ); +* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] +*/ +declare function sliceTo( x: float16ndarray, stop: ArrayLike, options?: Options ): float16ndarray; + +/** +* Returns a read-only truncated view of an input ndarray. +* +* @param x - input array +* @param stop - ending indices (exclusive) +* @param options - function options +* @param options.strict - boolean indicating whether to enforce strict bounds checking +* @returns output array +* +* @example +* 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 y = sliceTo( x, 2, null ); +* // returns +* +* sh = y.shape; +* // returns [ 2, 2 ] +* +* arr = ndarray2array( y ); +* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] +*/ +declare function sliceTo( x: float16ndarray, ...stop: Array ): float16ndarray; + /** * Returns a read-only truncated view of an input ndarray. * diff --git a/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/test.ts index 804dfa3670f4..86226571483f 100644 --- a/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/test.ts +++ b/lib/node_modules/@stdlib/ndarray/slice-to/docs/types/test.ts @@ -30,6 +30,7 @@ import sliceTo = require( './index' ); sliceTo( empty( 'float64', sh, order ), s ); // $ExpectType float64ndarray sliceTo( empty( 'float32', sh, order ), s ); // $ExpectType float32ndarray + sliceTo( empty( 'float16', sh, order ), s ); // $ExpectType float16ndarray sliceTo( empty( 'complex128', sh, order ), s ); // $ExpectType complex128ndarray sliceTo( empty( 'complex64', sh, order ), s ); // $ExpectType complex64ndarray sliceTo( empty( 'int32', sh, order ), s ); // $ExpectType int32ndarray @@ -42,6 +43,7 @@ import sliceTo = require( './index' ); sliceTo( empty( 'float64', sh, order ), 1, null ); // $ExpectType float64ndarray sliceTo( empty( 'float32', sh, order ), 1, null ); // $ExpectType float32ndarray + sliceTo( empty( 'float16', sh, order ), 1, null ); // $ExpectType float16ndarray sliceTo( empty( 'complex128', sh, order ), 1, null ); // $ExpectType complex128ndarray sliceTo( empty( 'complex64', sh, order ), 1, null ); // $ExpectType complex64ndarray sliceTo( empty( 'int32', sh, order ), 1, null ); // $ExpectType int32ndarray @@ -54,6 +56,7 @@ import sliceTo = require( './index' ); sliceTo( empty( 'float64', sh, order ), s, { 'strict': false } ); // $ExpectType float64ndarray sliceTo( empty( 'float32', sh, order ), s, { 'strict': false } ); // $ExpectType float32ndarray + sliceTo( empty( 'float16', sh, order ), s, { 'strict': false } ); // $ExpectType float16ndarray sliceTo( empty( 'complex128', sh, order ), s, { 'strict': false } ); // $ExpectType complex128ndarray sliceTo( empty( 'complex64', sh, order ), s, { 'strict': false } ); // $ExpectType complex64ndarray sliceTo( empty( 'int32', sh, order ), s, { 'strict': false } ); // $ExpectType int32ndarray @@ -66,6 +69,7 @@ import sliceTo = require( './index' ); sliceTo( empty( 'float64', sh, order ), 1, null, { 'strict': false } ); // $ExpectType float64ndarray sliceTo( empty( 'float32', sh, order ), 1, null, { 'strict': false } ); // $ExpectType float32ndarray + sliceTo( empty( 'float16', sh, order ), 1, null, { 'strict': false } ); // $ExpectType float16ndarray sliceTo( empty( 'complex128', sh, order ), 1, null, { 'strict': false } ); // $ExpectType complex128ndarray sliceTo( empty( 'complex64', sh, order ), 1, null, { 'strict': false } ); // $ExpectType complex64ndarray sliceTo( empty( 'int32', sh, order ), 1, null, { 'strict': false } ); // $ExpectType int32ndarray diff --git a/lib/node_modules/@stdlib/ndarray/slice-to/test/test.js b/lib/node_modules/@stdlib/ndarray/slice-to/test/test.js index e8821402b0f2..3598e3bda736 100644 --- a/lib/node_modules/@stdlib/ndarray/slice-to/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/slice-to/test/test.js @@ -633,17 +633,23 @@ tape( 'in non-strict mode, the function returns an empty array when an ending in var stop; var i; + /* eslint-disable stdlib/line-closing-bracket-spacing */ + 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' } ) ]; + /* eslint-enable stdlib/line-closing-bracket-spacing */ + stop = [ [ -10 ], [ null, -20 ], + [ null, -20 ], [ -20, null, null ], [ -20, -20, null, null ], [ null, null, null, null, -10 ] @@ -665,17 +671,23 @@ tape( 'the function returns an empty array when an ending index is the first ele var stop; var i; + /* eslint-disable stdlib/line-closing-bracket-spacing */ + 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' } ) ]; + /* eslint-enable stdlib/line-closing-bracket-spacing */ + stop = [ [ 0 ], [ null, 0 ], + [ null, 0 ], [ 0, null, null ], [ 0, 0, null, null ], [ null, null, null, null, 0 ]