diff --git a/lib/node_modules/@stdlib/ndarray/from-scalar-like/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/from-scalar-like/benchmark/benchmark.js
index 490473ba2feb..04ffd4288728 100644
--- a/lib/node_modules/@stdlib/ndarray/from-scalar-like/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/ndarray/from-scalar-like/benchmark/benchmark.js
@@ -80,6 +80,30 @@ bench( format( '%s:dtype=float32', pkg ), function benchmark( b ) {
b.end();
});
+bench( format( '%s:dtype=float16', pkg ), function benchmark( b ) {
+ var x;
+ var o;
+ var i;
+
+ x = empty( [ 2 ] );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = scalar2ndarrayLike( x, i, {
+ 'dtype': 'float16'
+ });
+ if ( o.length !== 1 ) {
+ b.fail( 'should have length 1' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( o ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
bench( format( '%s:dtype=complex128', pkg ), function benchmark( b ) {
var x;
var o;
diff --git a/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/index.d.ts
index 3d1b50932441..d1e07bad56d8 100644
--- a/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/index.d.ts
@@ -21,7 +21,7 @@
///
import { ComplexLike } from '@stdlib/types/complex';
-import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, genericndarray, boolndarray, DataType, Order, Float64DataType, Float32DataType, Complex128DataType, Complex64DataType, BooleanDataType, Int32DataType, Int16DataType, Int8DataType, Uint32DataType, Uint16DataType, Uint8DataType, Uint8cDataType, GenericDataType } from '@stdlib/types/ndarray';
+import { ndarray, float64ndarray, float32ndarray, float16ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, genericndarray, boolndarray, DataType, Order, Float64DataType, Float32DataType, Float16DataType, Complex128DataType, Complex64DataType, BooleanDataType, Int32DataType, Int16DataType, Int8DataType, Uint32DataType, Uint16DataType, Uint8DataType, Uint8cDataType, GenericDataType } from '@stdlib/types/ndarray';
/**
* Interface defining common options.
@@ -68,6 +68,16 @@ interface Float32Options extends BaseOptions {
dtype: Float32DataType;
}
+/**
+* Interface defining options when `dtype` is `'float16'`.
+*/
+interface Float16Options extends BaseOptions {
+ /**
+ * Output array data type.
+ */
+ dtype: Float16DataType;
+}
+
/**
* Interface defining options when `dtype` is `'complex128'`.
*/
@@ -292,6 +302,64 @@ declare function scalar2ndarrayLike( x: float32ndarray, value: number, options?:
*/
declare function scalar2ndarrayLike( x: ndarray, value: number, options: Float32Options ): float32ndarray;
+/**
+* Converts a scalar value to a zero-dimensional ndarray having the same data type as a provided ndarray.
+*
+* @param x - input ndarray
+* @param value - scalar value
+* @param options - function options
+* @returns zero-dimensional ndarray
+*
+* @example
+* var getShape = require( '@stdlib/ndarray/shape' );
+* var getDType = require( '@stdlib/ndarray/dtype' );
+* var empty = require( '@stdlib/ndarray/empty' );
+*
+* var x = empty( [ 2 ], {
+* 'dtype': 'float16'
+* });
+* // returns
+*
+* var out = scalar2ndarrayLike( x, 1.0 );
+* // returns [ 1.0 ]
+*
+* var sh = getShape( out );
+* // returns []
+*
+* var dt = String( getDType( out ) );
+* // returns 'float16'
+*/
+declare function scalar2ndarrayLike( x: float16ndarray, value: number, options?: BaseOptions ): float16ndarray;
+
+/**
+* Converts a scalar value to a zero-dimensional ndarray having the same data type as a provided ndarray.
+*
+* @param x - input ndarray
+* @param value - scalar value
+* @param options - function options
+* @returns zero-dimensional ndarray
+*
+* @example
+* var getShape = require( '@stdlib/ndarray/shape' );
+* var getDType = require( '@stdlib/ndarray/dtype' );
+* var empty = require( '@stdlib/ndarray/empty' );
+*
+* var x = empty( [ 2 ] );
+* // returns
+*
+* var out = scalar2ndarrayLike( x, 1.0, {
+* 'dtype': 'float16'
+* });
+* // returns [ 1.0 ]
+*
+* var sh = getShape( out );
+* // returns []
+*
+* var dt = String( getDType( out ) );
+* // returns 'float16'
+*/
+declare function scalar2ndarrayLike( x: ndarray, value: number, options: Float16Options ): float16ndarray;
+
/**
* Converts a scalar value to a zero-dimensional ndarray having the same data type as a provided ndarray.
*
diff --git a/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/test.ts
index 46c6f4d45bf7..a7c8341de850 100644
--- a/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/test.ts
+++ b/lib/node_modules/@stdlib/ndarray/from-scalar-like/docs/types/test.ts
@@ -34,6 +34,7 @@ import scalar2ndarrayLike = require( './index' );
scalar2ndarrayLike( x, 1.0, { 'dtype': 'float64' } ); // $ExpectType float64ndarray
scalar2ndarrayLike( x, 1.0, { 'dtype': 'float32' } ); // $ExpectType float32ndarray
+ scalar2ndarrayLike( x, 1.0, { 'dtype': 'float16' } ); // $ExpectType float16ndarray
scalar2ndarrayLike( x, 1.0, { 'dtype': 'complex128' } ); // $ExpectType complex128ndarray
scalar2ndarrayLike( x, 1.0, { 'dtype': 'complex64' } ); // $ExpectType complex64ndarray
scalar2ndarrayLike( x, true, { 'dtype': 'bool' } ); // $ExpectType boolndarray
diff --git a/lib/node_modules/@stdlib/ndarray/from-scalar-like/test/test.js b/lib/node_modules/@stdlib/ndarray/from-scalar-like/test/test.js
index 26266f5750a7..d38a53eaea41 100644
--- a/lib/node_modules/@stdlib/ndarray/from-scalar-like/test/test.js
+++ b/lib/node_modules/@stdlib/ndarray/from-scalar-like/test/test.js
@@ -23,6 +23,7 @@
var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
+var Float16Array = require( '@stdlib/array/float16' );
var Int32Array = require( '@stdlib/array/int32' );
var Uint32Array = require( '@stdlib/array/uint32' );
var Int16Array = require( '@stdlib/array/int16' );
@@ -414,6 +415,29 @@ tape( 'the function returns a zero-dimensional ndarray (dtype=float32)', functio
t.end();
});
+tape( 'the function returns a zero-dimensional ndarray (dtype=float16)', function test( t ) {
+ var expected;
+ var arr;
+ var x;
+
+ x = empty( [ 2 ] );
+
+ arr = scalar2ndarrayLike( x, 1.0, {
+ 'dtype': 'float16'
+ });
+ expected = new Float16Array( [ 1.0 ] );
+
+ t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' );
+ t.strictEqual( String( getDType( arr ) ), 'float16', 'returns expected value' );
+ t.deepEqual( getShape( arr ), [], 'returns expected value' );
+ t.strictEqual( instanceOf( getData( arr ), Float16Array ), true, 'returns expected value' );
+ t.deepEqual( getData( arr ), expected, 'returns expected value' );
+ t.strictEqual( getOrder( arr ), 'row-major', 'returns expected value' );
+ t.strictEqual( numel( arr ), 1, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a zero-dimensional ndarray (dtype=int32)', function test( t ) {
var expected;
var arr;