Skip to content

Commit e89a960

Browse files
committed
Auto-generated commit
1 parent 723fab7 commit e89a960

10 files changed

Lines changed: 340 additions & 5 deletions

File tree

.github/.keepalive

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

CHANGELOG.md

Lines changed: 15 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-01)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`c81fa28`](https://github.com/stdlib-js/stdlib/commit/c81fa285dfb9908737f43e73032197a9c535e7a9) - add float16 dtype support to `array/filled` [(#13052)](https://github.com/stdlib-js/stdlib/pull/13052)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`c81fa28`](https://github.com/stdlib-js/stdlib/commit/c81fa285dfb9908737f43e73032197a9c535e7a9) - **feat:** add float16 dtype support to `array/filled` [(#13052)](https://github.com/stdlib-js/stdlib/pull/13052) _(by Gururaj Gurram, Athan Reines)_
1526
- [`e487975`](https://github.com/stdlib-js/stdlib/commit/e487975ccd8c36a0c13d3765bac19de5995104d5) - **bench:** refactor to use string interpolation in `array/filled` [(#10321)](https://github.com/stdlib-js/stdlib/pull/10321) _(by Shubham)_
1627

1728
</details>
@@ -24,8 +35,10 @@
2435

2536
### Contributors
2637

27-
A total of 1 person contributed to this release. Thank you to this contributor:
38+
A total of 3 people contributed to this release. Thank you to the following contributors:
2839

40+
- Athan Reines
41+
- Gururaj Gurram
2942
- Shubham
3043

3144
</section>

benchmark/benchmark.js

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

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

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/types/index.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ import { IterableIterator } from '@stdlib/types/iter';
3838
* @example
3939
* var arr = filledarray( 'float32' );
4040
* // returns <Float32Array>
41+
*
42+
* @example
43+
* var arr = filledarray( 'float16' );
44+
* // returns <Float16Array>
4145
*/
4246
declare function filledarray<T = any, U extends keyof DataTypeMap<T> = 'float64'>( dtype?: U ): DataTypeMap<any>[U];
4347

@@ -56,6 +60,10 @@ declare function filledarray<T = any, U extends keyof DataTypeMap<T> = 'float64'
5660
* @example
5761
* var arr = filledarray( 1.0, 5, 'float32' );
5862
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
63+
*
64+
* @example
65+
* var arr = filledarray( 1.0, 5, 'float16' );
66+
* // returns <Float16Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
5967
*/
6068
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, length: number, dtype?: U ): DataTypeMap<T>[U];
6169

@@ -74,6 +82,10 @@ declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( val
7482
* @example
7583
* var arr = filledarray( 1.0, [ 5.0, -3.0, 2.0 ], 'float32' );
7684
* // returns <Float32Array>[ 1.0, 1.0, 1.0 ]
85+
*
86+
* @example
87+
* var arr = filledarray( 1.0, [ 5.0, -3.0, 2.0 ], 'float16' );
88+
* // returns <Float16Array>[ 1.0, 1.0, 1.0 ]
7789
*/
7890
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, array: Collection, dtype?: U ): DataTypeMap<T>[U];
7991

@@ -102,6 +114,15 @@ declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( val
102114
* });
103115
* var arr = filledarray( 1.0, it, 'float32' );
104116
* // returns <Float32Array>[ 1.0, 1.0, 1.0 ]
117+
*
118+
* @example
119+
* var iterConstant = require( '@stdlib/iter-constant' );
120+
*
121+
* var it = iterConstant( 3.0, {
122+
* 'iter': 3
123+
* });
124+
* var arr = filledarray( 1.0, it, 'float16' );
125+
* // returns <Float16Array>[ 1.0, 1.0, 1.0 ]
105126
*/
106127
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, iterable: IterableIterator, dtype?: U ): DataTypeMap<T>[U];
107128

@@ -132,6 +153,13 @@ declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( val
132153
* var buf = new ArrayBuffer( 32 );
133154
* var arr = filledarray( 1.0, buf, 8, 2, 'float32' );
134155
* // returns <Float32Array>[ 1.0, 1.0 ]
156+
*
157+
* @example
158+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
159+
*
160+
* var buf = new ArrayBuffer( 32 );
161+
* var arr = filledarray( 1.0, buf, 8, 2, 'float16' );
162+
* // returns <Float16Array>[ 1.0, 1.0 ]
135163
*/
136164
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, byteOffset: number, length: number, dtype?: U ): DataTypeMap<T>[U];
137165

@@ -161,6 +189,13 @@ declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( val
161189
* var buf = new ArrayBuffer( 32 );
162190
* var arr = filledarray( 1.0, buf, 8, 'float32' );
163191
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
192+
*
193+
* @example
194+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
195+
*
196+
* var buf = new ArrayBuffer( 32 );
197+
* var arr = filledarray( 1.0, buf, 8, 'float16' );
198+
* // returns <Float16Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
164199
*/
165200
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, byteOffset: number, dtype?: U ): DataTypeMap<T>[U];
166201

@@ -189,6 +224,13 @@ declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( val
189224
* var buf = new ArrayBuffer( 32 );
190225
* var arr = filledarray( 1.0, buf, 'float32' );
191226
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
227+
*
228+
* @example
229+
* var ArrayBuffer = require( '@stdlib/array-buffer' );
230+
*
231+
* var buf = new ArrayBuffer( 16 );
232+
* var arr = filledarray( 1.0, buf, 'float16' );
233+
* // returns <Float16Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
192234
*/
193235
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, dtype?: U ): DataTypeMap<T>[U];
194236

lib/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
* @example
4545
* var filledarray = require( '@stdlib/array-filled' );
4646
*
47+
* var arr = filledarray( 1.0, 2, 'float16' );
48+
* // returns <Float16Array>[ 1.0, 1.0 ]
49+
*
50+
* @example
51+
* var filledarray = require( '@stdlib/array-filled' );
52+
*
4753
* var arr = filledarray( 1.0, 2, 'generic' );
4854
* // returns [ 1.0, 1.0 ]
4955
*

lib/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ function filledAccessors( arr, value ) {
115115
* // returns <Float32Array>[ 1.0, 1.0 ]
116116
*
117117
* @example
118+
* var arr = filledarray( 1.0, 2, 'float16' );
119+
* // returns <Float16Array>[ 1.0, 1.0 ]
120+
*
121+
* @example
118122
* var arr = filledarray( 1.0, 2, 'generic' );
119123
* // returns [ 1.0, 1.0 ]
120124
*

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"@stdlib/array-buffer": "^0.2.3",
6363
"@stdlib/array-complex128": "^0.3.2",
6464
"@stdlib/array-complex64": "^0.3.2",
65+
"@stdlib/array-float16": "github:stdlib-js/array-float16#main",
6566
"@stdlib/array-float32": "^0.2.3",
6667
"@stdlib/array-float64": "^0.2.3",
6768
"@stdlib/array-int16": "^0.2.3",

0 commit comments

Comments
 (0)