Skip to content

Commit f21fc5a

Browse files
committed
Auto-generated commit
1 parent 7b5dce1 commit f21fc5a

13 files changed

Lines changed: 154 additions & 6 deletions

File tree

.github/.keepalive

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

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
- name: 'Replace GitHub MathJax equations with SVGs'
154154
run: |
155155
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/```math\n([\s\S]+?)\n```\n\n//g'
156-
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/<!-- <div class="equation"(.*)(<\/div>\s*-->)/<div class="equation"$1<\/div>/sg'
156+
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/<!-- <div class="equation"(.*?)(<\/div>\s*-->)/<div class="equation"$1<\/div>/sg'
157157
158158
# Replace GitHub links to individual packages with npm links:
159159
- name: 'Replace all GitHub links to individual packages with npm links'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,4 @@ jsconfig.json
202202
####################
203203
CLAUDE.md
204204
GEMINI.md
205+
.claude/

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-08-10)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`2e31902`](https://github.com/stdlib-js/stdlib/commit/2e31902b44dfa195f9caa5ece57b1649a000e47a) - add float16 dtype support to `array/ones` [(#14123)](https://github.com/stdlib-js/stdlib/pull/14123)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`2e31902`](https://github.com/stdlib-js/stdlib/commit/2e31902b44dfa195f9caa5ece57b1649a000e47a) - **feat:** add float16 dtype support to `array/ones` [(#14123)](https://github.com/stdlib-js/stdlib/pull/14123) _(by Gururaj Gurram)_
1526
- [`3323474`](https://github.com/stdlib-js/stdlib/commit/3323474c193b0a1cf6501ea8bf54381392562af6) - **refactor:** explicitly validate a provided input dtype _(by Athan Reines)_
1627

1728
</details>
@@ -24,9 +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 2 people contributed to this release. Thank you to the following contributors:
2839

2940
- Athan Reines
41+
- Gururaj Gurram
3042

3143
</section>
3244

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
@@ -133,7 +134,7 @@ var dtypes = require( '@stdlib/array-dtypes' );
133134
var ones = require( '@stdlib/array-ones' );
134135

135136
// Get a list of array data types:
136-
var dt = dtypes();
137+
var dt = dtypes( 'numeric' );
137138

138139
// Generate filled arrays...
139140
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 = ones( 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 ones = 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 = ones( 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=%s,len=%d', pkg, 'float16', 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 ones = require( './index' );
2626
ones( 10 ); // $ExpectType Float64Array
2727
ones( 10, 'float64' ); // $ExpectType Float64Array
2828
ones( 10, 'float32' ); // $ExpectType Float32Array
29+
ones( 10, 'float16' ); // $ExpectType Float16ArrayFallback
2930
ones( 10, 'complex128' ); // $ExpectType Complex128Array
3031
ones( 10, 'complex64' ); // $ExpectType Complex64Array
3132
ones( 10, 'int32' ); // $ExpectType Int32Array

0 commit comments

Comments
 (0)