Skip to content

Commit 4aa9dbf

Browse files
committed
Auto-generated commit
1 parent bfd8a6b commit 4aa9dbf

8 files changed

Lines changed: 168 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<section class="release" id="unreleased">
66

7-
## Unreleased (2026-09-22)
7+
## Unreleased (2026-09-23)
88

99
<section class="features">
1010

1111
### Features
1212

13+
- [`2e195f2`](https://github.com/stdlib-js/stdlib/commit/2e195f2882e753e2f467ff5b0049467c70151062) - add float16 dtype support to `ndarray/base/nans` [(#15434)](https://github.com/stdlib-js/stdlib/pull/15434)
1314
- [`5f6b7b3`](https://github.com/stdlib-js/stdlib/commit/5f6b7b35889c91d3183477fce13c5e15c6320d92) - add `ndarray/base/kernels/generic/binary-strided1d/blocked` [(#14939)](https://github.com/stdlib-js/stdlib/pull/14939)
1415
- [`46f04eb`](https://github.com/stdlib-js/stdlib/commit/46f04ebe040918f014194ef90470f39c866ce712) - add float16 dtype support to `ndarray/ones` [(#15276)](https://github.com/stdlib-js/stdlib/pull/15276)
1516
- [`920106e`](https://github.com/stdlib-js/stdlib/commit/920106e17dd93027fac9d9648bc0303c8aabfbb8) - add support for `float16` data type [(#15340)](https://github.com/stdlib-js/stdlib/pull/15340)
@@ -117,6 +118,7 @@ A total of 4 issues were closed in this release:
117118

118119
<details>
119120

121+
- [`2e195f2`](https://github.com/stdlib-js/stdlib/commit/2e195f2882e753e2f467ff5b0049467c70151062) - **feat:** add float16 dtype support to `ndarray/base/nans` [(#15434)](https://github.com/stdlib-js/stdlib/pull/15434) _(by Samarth Kolarkar)_
120122
- [`4e396e9`](https://github.com/stdlib-js/stdlib/commit/4e396e96156bc653142e560ce866c0d0978bdf83) - **chore:** clean-up [(#15425)](https://github.com/stdlib-js/stdlib/pull/15425) _(by Philipp Burckhardt)_
121123
- [`5f6b7b3`](https://github.com/stdlib-js/stdlib/commit/5f6b7b35889c91d3183477fce13c5e15c6320d92) - **feat:** add `ndarray/base/kernels/generic/binary-strided1d/blocked` [(#14939)](https://github.com/stdlib-js/stdlib/pull/14939) _(by Kaustubh Patange)_
122124
- [`71758bb`](https://github.com/stdlib-js/stdlib/commit/71758bb364a856a954baa9b7661d5d2da6172ea2) - **docs:** fix description [(#15265)](https://github.com/stdlib-js/stdlib/pull/15265) _(by Philipp Burckhardt, Athan Reines)_

‎base/nans/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var nans = require( '@stdlib/ndarray/base/nans' );
8787
var dt = [
8888
'float64',
8989
'float32',
90+
'float16',
9091
'complex128',
9192
'complex64',
9293
'generic'

‎base/nans/benchmark/benchmark.js‎

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

68+
bench( format( '%s:dtype=float16', pkg ), function benchmark( b ) {
69+
var arr;
70+
var i;
71+
b.tic();
72+
for ( i = 0; i < b.iterations; i++ ) {
73+
arr = nans( 'float16', [ 0 ], 'row-major' );
74+
if ( arr.length !== 0 ) {
75+
b.fail( 'should have length 0' );
76+
}
77+
}
78+
b.toc();
79+
if ( !isndarrayLike( arr ) ) {
80+
b.fail( 'should return an ndarray' );
81+
}
82+
b.pass( 'benchmark finished' );
83+
b.end();
84+
});
85+
6886
bench( format( '%s:dtype=complex128', pkg ), function benchmark( b ) {
6987
var arr;
7088
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' );
24+
var pow = require( '@stdlib/math/base/special/pow' );
25+
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
26+
var format = require( '@stdlib/string/format' );
27+
var pkg = require( './../package.json' ).name;
28+
var nans = 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 = nans( 'float16', [ len ], 'row-major' );
56+
if ( arr.length !== len ) {
57+
b.fail( 'unexpected length' );
58+
}
59+
}
60+
b.toc();
61+
if ( !isndarrayLike( arr ) ) {
62+
b.fail( 'should return an ndarray' );
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,size=%d', pkg, len ), f );
91+
}
92+
}
93+
94+
main();

‎base/nans/docs/types/index.d.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Shape, Order, typedndarray, genericndarray, float64ndarray, float32ndarray, complex128ndarray, complex64ndarray, FloatingPointAndGenericDataType, GenericDataType, Float64DataType, Float32DataType, Complex128DataType, Complex64DataType } from '@stdlib/types/ndarray';
23+
import { Shape, Order, typedndarray, genericndarray, float64ndarray, float32ndarray, float16ndarray, complex128ndarray, complex64ndarray, FloatingPointAndGenericDataType, GenericDataType, Float64DataType, Float32DataType, Float16DataType, Complex128DataType, Complex64DataType } from '@stdlib/types/ndarray';
2424

2525
/**
2626
* Creates a NaN-filled ndarray having a specified shape and data type.
@@ -60,6 +60,25 @@ declare function nans( dtype: Float64DataType, shape: Shape, order: Order ): flo
6060
*/
6161
declare function nans( dtype: Float32DataType, shape: Shape, order: Order ): float32ndarray;
6262

63+
/**
64+
* Creates a NaN-filled ndarray having a specified shape and data type.
65+
*
66+
* @param dtype - underlying data type
67+
* @param shape - array shape
68+
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
69+
* @returns NaN-filled ndarray
70+
*
71+
* @example
72+
* var getDType = require( '@stdlib/ndarray/dtype' );
73+
*
74+
* var arr = nans( 'float16', [ 2, 2 ], 'row-major' );
75+
* // returns <ndarray>[ [ NaN, NaN ], [ NaN, NaN ] ]
76+
*
77+
* var dt = String( getDType( arr ) );
78+
* // returns 'float16'
79+
*/
80+
declare function nans( dtype: Float16DataType, shape: Shape, order: Order ): float16ndarray;
81+
6382
/**
6483
* Creates a NaN-filled ndarray having a specified shape and data type.
6584
*

‎base/nans/docs/types/test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ import nans = require( './index' );
2525
{
2626
nans( 'float64', [ 2, 2 ], 'row-major' ); // $ExpectType float64ndarray
2727
nans( 'float32', [ 2, 2 ], 'row-major' ); // $ExpectType float32ndarray
28+
nans( 'float16', [ 2, 2 ], 'row-major' ); // $ExpectType float16ndarray
2829
nans( 'complex128', [ 2, 2 ], 'row-major' ); // $ExpectType complex128ndarray
2930
nans( 'complex64', [ 2, 2 ], 'row-major' ); // $ExpectType complex64ndarray
3031
nans( 'generic', [ 2, 2 ], 'row-major' ); // $ExpectType genericndarray<number>
3132

3233
nans( 'float64', [ 2, 2 ], 'column-major' ); // $ExpectType float64ndarray
3334
nans( 'float32', [ 2, 2 ], 'column-major' ); // $ExpectType float32ndarray
35+
nans( 'float16', [ 2, 2 ], 'column-major' ); // $ExpectType float16ndarray
3436
nans( 'complex128', [ 2, 2 ], 'column-major' ); // $ExpectType complex128ndarray
3537
nans( 'complex64', [ 2, 2 ], 'column-major' ); // $ExpectType complex64ndarray
3638
nans( 'generic', [ 2, 2 ], 'column-major' ); // $ExpectType genericndarray<number>

‎base/nans/examples/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var nans = require( './../lib' );
2424
var dt = [
2525
'float64',
2626
'float32',
27+
'float16',
2728
'complex128',
2829
'complex64',
2930
'generic'

‎base/nans/test/test.js‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var tape = require( 'tape' );
2424
var Float64Array = require( '@stdlib/array/float64' );
2525
var Float32Array = require( '@stdlib/array/float32' );
26+
var Float16Array = require( '@stdlib/array/float16' );
2627
var Complex64Array = require( '@stdlib/array/complex64' );
2728
var Complex128Array = require( '@stdlib/array/complex128' );
2829
var reinterpret64 = require( '@stdlib/strided/base/reinterpret-complex64' );
@@ -164,6 +165,34 @@ tape( 'the function returns a NaN-filled array (dtype=float32, order=column-majo
164165
t.end();
165166
});
166167

168+
tape( 'the function returns a NaN-filled array (dtype=float16, order=row-major)', function test( t ) {
169+
var arr;
170+
171+
arr = nans( 'float16', [ 2, 2 ], 'row-major' );
172+
t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' );
173+
t.strictEqual( String( getDType( arr ) ), 'float16', 'returns expected value' );
174+
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
175+
t.strictEqual( instanceOf( getData( arr ), Float16Array ), true, 'returns expected value' );
176+
t.strictEqual( allNaN( getData( arr ) ), true, 'returns expected value' );
177+
t.strictEqual( getOrder( arr ), 'row-major', 'returns expected value' );
178+
179+
t.end();
180+
});
181+
182+
tape( 'the function returns a NaN-filled array (dtype=float16, order=column-major)', function test( t ) {
183+
var arr;
184+
185+
arr = nans( 'float16', [ 2, 2 ], 'column-major' );
186+
t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' );
187+
t.strictEqual( String( getDType( arr ) ), 'float16', 'returns expected value' );
188+
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
189+
t.strictEqual( instanceOf( getData( arr ), Float16Array ), true, 'returns expected value' );
190+
t.strictEqual( allNaN( getData( arr ) ), true, 'returns expected value' );
191+
t.strictEqual( getOrder( arr ), 'column-major', 'returns expected value' );
192+
193+
t.end();
194+
});
195+
167196
tape( 'the function returns a NaN-filled array (dtype=complex128, order=row-major)', function test( t ) {
168197
var arr;
169198

0 commit comments

Comments
 (0)