diff --git a/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.js
index 191094afd70a..49a90ebe887c 100644
--- a/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.js
@@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' );
var isCollection = require( '@stdlib/assert/is-collection' );
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 Int16Array = require( '@stdlib/array/int16' );
var Int8Array = require( '@stdlib/array/int8' );
@@ -122,6 +123,34 @@ bench( format( '%s:dtype=float32', pkg ), function benchmark( b ) {
b.end();
});
+bench( format( '%s:dtype=float16', pkg ), function benchmark( b ) {
+ var arr;
+ var out;
+ var v;
+ var i;
+
+ arr = [];
+ for ( i = 0; i < 10; i++ ) {
+ arr.push( i );
+ }
+ v = new Float16Array( 0 );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ arr[ 0 ] += 1;
+ out = convertArraySame( arr, v );
+ if ( out.length !== arr.length ) {
+ b.fail( 'should have expected length' );
+ }
+ }
+ b.toc();
+ if ( !isCollection( out ) ) {
+ b.fail( 'should return an array-like object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
bench( format( '%s:dtype=bool', pkg ), function benchmark( b ) {
var arr;
var out;
diff --git a/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.length.js b/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.length.js
index 080347e82bcc..92e8eb8abb5f 100644
--- a/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.length.js
+++ b/lib/node_modules/@stdlib/array/convert-same/benchmark/benchmark.length.js
@@ -25,6 +25,7 @@ var pow = require( '@stdlib/math/base/special/pow' );
var isCollection = require( '@stdlib/assert/is-collection' );
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 Int16Array = require( '@stdlib/array/int16' );
var Int8Array = require( '@stdlib/array/int8' );
@@ -116,6 +117,9 @@ function main() {
f = createBenchmark( len, new Float32Array( 0 ) );
bench( format( '%s:len=%d,dtype=float32', pkg, len ), f );
+ f = createBenchmark( len, new Float16Array( 0 ) );
+ bench( format( '%s:len=%d,dtype=float16', pkg, len ), f );
+
f = createBenchmark( len, new Int32Array( 0 ) );
bench( format( '%s:len=%d,dtype=int32', pkg, len ), f );
diff --git a/lib/node_modules/@stdlib/array/convert-same/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/array/convert-same/benchmark/julia/benchmark.jl
index 194844d84c84..958ac4722386 100755
--- a/lib/node_modules/@stdlib/array/convert-same/benchmark/julia/benchmark.jl
+++ b/lib/node_modules/@stdlib/array/convert-same/benchmark/julia/benchmark.jl
@@ -169,6 +169,7 @@ function main()
dtypes = [
Float64,
Float32,
+ Float16,
Int32,
Int16,
Int8,
diff --git a/lib/node_modules/@stdlib/array/convert-same/benchmark/python/numpy/benchmark.py b/lib/node_modules/@stdlib/array/convert-same/benchmark/python/numpy/benchmark.py
index b809d32b3495..35d3c43ab035 100755
--- a/lib/node_modules/@stdlib/array/convert-same/benchmark/python/numpy/benchmark.py
+++ b/lib/node_modules/@stdlib/array/convert-same/benchmark/python/numpy/benchmark.py
@@ -107,6 +107,7 @@ def main():
dtypes = [
"float64",
"float32",
+ "float16",
"int32",
"int16",
"int8",
@@ -120,8 +121,7 @@ def main():
n = 1
while n < 1e7:
n *= 10
- for i in range(0, len(dtypes)):
- dtype = dtypes[i]
+ for dtype in dtypes:
name = ":len="+str(n)+",dtype="+dtype
setup = "import numpy as np;"
setup += "A = np.ones([1,"+str(n)+"], dtype='float64');"
diff --git a/lib/node_modules/@stdlib/array/convert-same/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/convert-same/docs/types/index.d.ts
index 5d86f5dc2d97..aafc52a28287 100644
--- a/lib/node_modules/@stdlib/array/convert-same/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/array/convert-same/docs/types/index.d.ts
@@ -20,7 +20,7 @@
///
-import { AnyArray, Collection, Complex128Array, Complex64Array, BooleanArray } from '@stdlib/types/array';
+import { AnyArray, Collection, Float16Array, Complex128Array, Complex64Array, BooleanArray } from '@stdlib/types/array';
/**
* Converts an array to a `Float64Array`.
@@ -58,6 +58,24 @@ declare function convertSame( x: Collection, y: Float64Array ): Float64Array;
*/
declare function convertSame( x: Collection, y: Float32Array ): Float32Array;
+/**
+* Converts an array to a `Float16Array`.
+*
+* @param x - array to convert
+* @param y - array having the desired output data type
+* @returns output array
+*
+* @example
+* var Float16Array = require( '@stdlib/array/float16' );
+*
+* var x = [ 1.0, 2.0, 3.0, 4.0 ];
+* var y = new Float16Array( 0 );
+*
+* var out = convertSame( x, y );
+* // returns [ 1.0, 2.0, 3.0, 4.0 ]
+*/
+declare function convertSame( x: Collection, y: Float16Array ): Float16Array;
+
/**
* Converts an array to an `Int32Array`.
*
diff --git a/lib/node_modules/@stdlib/array/convert-same/docs/types/test.ts b/lib/node_modules/@stdlib/array/convert-same/docs/types/test.ts
index 534c3e2b23c1..b9ac6577ce4a 100644
--- a/lib/node_modules/@stdlib/array/convert-same/docs/types/test.ts
+++ b/lib/node_modules/@stdlib/array/convert-same/docs/types/test.ts
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import Float16Array = require( '@stdlib/array/float16' );
import Complex128Array = require( '@stdlib/array/complex128' );
import Complex64Array = require( '@stdlib/array/complex64' );
import BooleanArray = require( '@stdlib/array/bool' );
@@ -28,6 +29,7 @@ import convertSame = require( './index' );
{
convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Float64Array( 0 ) ); // $ExpectType Float64Array
convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Float32Array( 0 ) ); // $ExpectType Float32Array
+ convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Float16Array( 0 ) ); // $ExpectType Float16ArrayFallback
convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Int32Array( 0 ) ); // $ExpectType Int32Array
convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Int16Array( 0 ) ); // $ExpectType Int16Array
convertSame( [ 1.0, 2.0, 3.0, 4.0 ], new Int8Array( 0 ) ); // $ExpectType Int8Array
diff --git a/lib/node_modules/@stdlib/array/convert-same/test/test.js b/lib/node_modules/@stdlib/array/convert-same/test/test.js
index 5b84aa00477a..c4046cc2de6b 100644
--- a/lib/node_modules/@stdlib/array/convert-same/test/test.js
+++ b/lib/node_modules/@stdlib/array/convert-same/test/test.js
@@ -26,6 +26,7 @@ var tape = require( 'tape' );
var dtype = require( '@stdlib/array/dtype' );
var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
+var Float16Array = require( '@stdlib/array/float16' );
var Int16Array = require( '@stdlib/array/int16' );
var Int32Array = require( '@stdlib/array/int32' );
var Int8Array = require( '@stdlib/array/int8' );
@@ -39,6 +40,7 @@ var BooleanArray = require( '@stdlib/array/bool' );
var isArray = require( '@stdlib/assert/is-array' );
var isFloat64Array = require( '@stdlib/assert/is-float64array' );
var isFloat32Array = require( '@stdlib/assert/is-float32array' );
+var isFloat16Array = require( '@stdlib/assert/is-float16array' );
var isInt16Array = require( '@stdlib/assert/is-int16array' );
var isInt32Array = require( '@stdlib/assert/is-int32array' );
var isInt8Array = require( '@stdlib/assert/is-int8array' );
@@ -156,6 +158,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
[],
new Int16Array( 0 ),
new Int32Array( 0 ),
@@ -169,6 +172,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
[ new Float64Array( [ -1.0, 0.0, 1.0 ] ), isFloat64Array ],
[ new Float32Array( [ -1.0, 0.0, 1.0 ] ), isFloat32Array ],
+ [ new Float16Array( [ -1.0, 0.0, 1.0 ] ), isFloat16Array ],
[ x, isArray ],
[ new Int16Array( [ -1, 0, 1 ] ), isInt16Array ],
[ new Int32Array( [ -1, 0, 1 ] ), isInt32Array ],
@@ -201,6 +205,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
[],
new Int16Array( 0 ),
new Int32Array( 0 ),
@@ -219,6 +224,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
[ new Float64Array( [ -1.0, 0.0, 1.0 ] ), isFloat64Array ],
[ new Float32Array( [ -1.0, 0.0, 1.0 ] ), isFloat32Array ],
+ [ new Float16Array( [ -1.0, 0.0, 1.0 ] ), isFloat16Array ],
[ [ -1, 0, 1 ], isArray ],
[ new Int16Array( [ -1, 0, 1 ] ), isInt16Array ],
[ new Int32Array( [ -1, 0, 1 ] ), isInt32Array ],
@@ -354,6 +360,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
new Int16Array( 0 ),
new Int32Array( 0 ),
new Int8Array( 0 ),
@@ -366,6 +373,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
[ new Float64Array( [ 1.0, 0.0, 1.0 ] ), isFloat64Array ],
[ new Float32Array( [ 1.0, 0.0, 1.0 ] ), isFloat32Array ],
+ [ new Float16Array( [ 1.0, 0.0, 1.0 ] ), isFloat16Array ],
[ new Int16Array( [ 1, 0, 1 ] ), isInt16Array ],
[ new Int32Array( [ 1, 0, 1 ] ), isInt32Array ],
[ new Int8Array( [ 1, 0, 1 ] ), isInt8Array ],
@@ -505,6 +513,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
new Int16Array( 0 ),
new Int32Array( 0 ),
new Int8Array( 0 ),
@@ -517,6 +526,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
[ new Float64Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat64Array ],
[ new Float32Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat32Array ],
+ [ new Float16Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat16Array ],
[ new Int16Array( [ -1, 0, 1, 2 ] ), isInt16Array ],
[ new Int32Array( [ -1, 0, 1, 2 ] ), isInt32Array ],
[ new Int8Array( [ -1, 0, 1, 2 ] ), isInt8Array ],
@@ -548,6 +558,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
new Int16Array( 0 ),
new Int32Array( 0 ),
new Int8Array( 0 ),
@@ -560,6 +571,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
[ new Float64Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat64Array ],
[ new Float32Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat32Array ],
+ [ new Float16Array( [ -1.0, 0.0, 1.0, 2.0 ] ), isFloat16Array ],
[ new Int16Array( [ -1, 0, 1, 2 ] ), isInt16Array ],
[ new Int32Array( [ -1, 0, 1, 2 ] ), isInt32Array ],
[ new Int8Array( [ -1, 0, 1, 2 ] ), isInt8Array ],
@@ -712,6 +724,7 @@ tape( 'the function converts an array to the same data type as a second input ar
y = [
new Float64Array( 0 ),
new Float32Array( 0 ),
+ new Float16Array( 0 ),
[],
new Int16Array( 0 ),
new Int32Array( 0 ),
@@ -731,6 +744,7 @@ tape( 'the function converts an array to the same data type as a second input ar
expected = [
isFloat64Array,
isFloat32Array,
+ isFloat16Array,
isArray,
isInt16Array,
isInt32Array,