Skip to content

Commit 9df4df9

Browse files
committed
Auto-generated commit
1 parent a96b7e2 commit 9df4df9

11 files changed

Lines changed: 152 additions & 5 deletions

File tree

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-06-27)
7+
## Unreleased (2026-07-03)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`8ccb4c3`](https://github.com/stdlib-js/stdlib/commit/8ccb4c3ad9a84fd6fb9c5a161ddf269d54c0e6d9) - add float16 dtype support to `array/zeros` [(#13056)](https://github.com/stdlib-js/stdlib/pull/13056)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`8ccb4c3`](https://github.com/stdlib-js/stdlib/commit/8ccb4c3ad9a84fd6fb9c5a161ddf269d54c0e6d9) - **feat:** add float16 dtype support to `array/zeros` [(#13056)](https://github.com/stdlib-js/stdlib/pull/13056) _(by Gururaj Gurram)_
1526
- [`b85a1da`](https://github.com/stdlib-js/stdlib/commit/b85a1da40b6ea52d966f7294933908c5d4c839d9) - **refactor:** perform expliict dtype argument validation _(by Athan Reines)_
1627
- [`bb63f81`](https://github.com/stdlib-js/stdlib/commit/bb63f8127455cd4fc055aec5aa600f4e5b1eafb5) - **bench:** refactor to use string interpolation in `array/zeros` [(#10272)](https://github.com/stdlib-js/stdlib/pull/10272) _(by Aman Singh)_
1728

@@ -25,10 +36,11 @@
2536

2637
### Contributors
2738

28-
A total of 2 people contributed to this release. Thank you to the following contributors:
39+
A total of 3 people contributed to this release. Thank you to the following contributors:
2940

3041
- Aman Singh
3142
- Athan Reines
43+
- Gururaj Gurram
3244

3345
</section>
3446

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ The function recognizes the following data types:
8686

8787
- `float64`: double-precision floating-point numbers (IEEE 754)
8888
- `float32`: single-precision floating-point numbers (IEEE 754)
89+
- `float16`: half-precision floating-point numbers (IEEE 754)
8990
- `complex128`: double-precision complex floating-point numbers
9091
- `complex64`: single-precision complex floating-point numbers
9192
- `int32`: 32-bit two's complement signed integers
@@ -129,7 +130,7 @@ var dtypes = require( '@stdlib/array-dtypes' );
129130
var zeros = require( '@stdlib/array-zeros' );
130131

131132
// Get a list of array data types:
132-
var dt = dtypes();
133+
var dt = dtypes( 'numeric' );
133134

134135
// Generate zero-filled arrays...
135136
var arr;

benchmark/benchmark.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ bench( format( '%s:dtype=%s', pkg, 'float32' ), function benchmark( b ) {
8484
b.end();
8585
});
8686

87+
bench( format( '%s:dtype=%s', pkg, 'float16' ), function benchmark( b ) {
88+
var arr;
89+
var i;
90+
b.tic();
91+
for ( i = 0; i < b.iterations; i++ ) {
92+
arr = zeros( 0, 'float16' );
93+
if ( arr.length !== 0 ) {
94+
b.fail( 'should have length 0' );
95+
}
96+
}
97+
b.toc();
98+
if ( !isTypedArrayLike( arr ) ) {
99+
b.fail( 'should return a typed array' );
100+
}
101+
b.pass( 'benchmark finished' );
102+
b.end();
103+
});
104+
87105
bench( format( '%s:dtype=%s', pkg, 'complex128' ), function benchmark( b ) {
88106
var arr;
89107
var i;
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench-harness' );
24+
var pow = require( '@stdlib/math-base-special-pow' );
25+
var isTypedArray = require( '@stdlib/assert-is-typed-array' );
26+
var format = require( '@stdlib/string-format' );
27+
var pkg = require( './../package.json' ).name;
28+
var zeros = require( './../lib' );
29+
30+
31+
// FUNCTIONS //
32+
33+
/**
34+
* Creates a benchmark function.
35+
*
36+
* @private
37+
* @param {PositiveInteger} len - array length
38+
* @returns {Function} benchmark function
39+
*/
40+
function createBenchmark( len ) {
41+
return benchmark;
42+
43+
/**
44+
* Benchmark function.
45+
*
46+
* @private
47+
* @param {Benchmark} b - benchmark instance
48+
*/
49+
function benchmark( b ) {
50+
var arr;
51+
var i;
52+
53+
b.tic();
54+
for ( i = 0; i < b.iterations; i++ ) {
55+
arr = zeros( len, 'float16' );
56+
if ( arr.length !== len ) {
57+
b.fail( 'unexpected length' );
58+
}
59+
}
60+
b.toc();
61+
if ( !isTypedArray( arr ) ) {
62+
b.fail( 'should return a typed array' );
63+
}
64+
b.pass( 'benchmark finished' );
65+
b.end();
66+
}
67+
}
68+
69+
70+
// MAIN //
71+
72+
/**
73+
* Main execution sequence.
74+
*
75+
* @private
76+
*/
77+
function main() {
78+
var len;
79+
var min;
80+
var max;
81+
var f;
82+
var i;
83+
84+
min = 1; // 10^min
85+
max = 6; // 10^max
86+
87+
for ( i = min; i <= max; i++ ) {
88+
len = pow( 10, i );
89+
f = createBenchmark( len );
90+
bench( format( '%s:dtype=float16,len=%d', pkg, len ), f );
91+
}
92+
}
93+
94+
main();

docs/repl.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- float64: double-precision floating-point numbers (IEEE 754).
88
- float32: single-precision floating-point numbers (IEEE 754).
9+
- float16: half-precision floating-point numbers (IEEE 754).
910
- complex128: double-precision complex floating-point numbers.
1011
- complex64: single-precision complex floating-point numbers.
1112
- int32: 32-bit two's complement signed integers.

docs/types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { NumericAndGenericDataTypeMap } from '@stdlib/types/array';
2929
*
3030
* - `float64`: double-precision floating-point numbers (IEEE 754)
3131
* - `float32`: single-precision floating-point numbers (IEEE 754)
32+
* - `float16`: half-precision floating-point numbers (IEEE 754)
3233
* - `complex128`: double-precision complex floating-point numbers
3334
* - `complex64`: single-precision complex floating-point numbers
3435
* - `int32`: 32-bit two's complement signed integers

docs/types/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import zeros = require( './index' );
2626
zeros( 10 ); // $ExpectType Float64Array
2727
zeros( 10, 'float64' ); // $ExpectType Float64Array
2828
zeros( 10, 'float32' ); // $ExpectType Float32Array
29+
zeros( 10, 'float16' ); // $ExpectType Float16ArrayFallback
2930
zeros( 10, 'complex128' ); // $ExpectType Complex128Array
3031
zeros( 10, 'complex64' ); // $ExpectType Complex64Array
3132
zeros( 10, 'int32' ); // $ExpectType Int32Array

examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var dtypes = require( '@stdlib/array-dtypes' );
2222
var zeros = require( './../lib' );
2323

2424
// Get a list of array data types:
25-
var dt = dtypes();
25+
var dt = dtypes( 'numeric' );
2626

2727
// Generate zero-filled arrays...
2828
var arr;

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"devDependencies": {
5252
"@stdlib/array-complex128": "^0.3.2",
5353
"@stdlib/array-complex64": "^0.3.2",
54+
"@stdlib/array-float16": "github:stdlib-js/array-float16#main",
5455
"@stdlib/array-float32": "^0.2.3",
5556
"@stdlib/array-float64": "^0.2.3",
5657
"@stdlib/array-int16": "^0.2.3",
@@ -102,6 +103,7 @@
102103
"matrix",
103104
"float64array",
104105
"float32array",
106+
"float16array",
105107
"int32array",
106108
"uint32array",
107109
"int16array",
@@ -123,6 +125,9 @@
123125
"float",
124126
"single-precision",
125127
"float32",
128+
"half",
129+
"half-precision",
130+
"float16",
126131
"ieee754",
127132
"integer",
128133
"int32",

0 commit comments

Comments
 (0)