Skip to content

Commit 7f1a4db

Browse files
committed
Auto-generated commit
1 parent 8726ffa commit 7f1a4db

7 files changed

Lines changed: 227 additions & 121 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`c38afb1`](https://github.com/stdlib-js/stdlib/commit/c38afb1481f0785a09095561486cb0e987609d37) - add float16 dtype support for `array/base/getter` [(#13223)](https://github.com/stdlib-js/stdlib/pull/13223)
1314
- [`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)
1415
- [`0fbbe42`](https://github.com/stdlib-js/stdlib/commit/0fbbe42ac5285b2fc13893c2c62667a59aedf272) - add float16 dtype support to `array/zero-to` [(#13054)](https://github.com/stdlib-js/stdlib/pull/13054)
1516
- [`b4e4ef2`](https://github.com/stdlib-js/stdlib/commit/b4e4ef2ab4b4818c248e41bedf68f2ff5c3dbcce) - add float16 datatype support in `array/dtypes` [(#9809)](https://github.com/stdlib-js/stdlib/pull/9809)
@@ -65,6 +66,7 @@ This release closes the following issue:
6566

6667
<details>
6768

69+
- [`c38afb1`](https://github.com/stdlib-js/stdlib/commit/c38afb1481f0785a09095561486cb0e987609d37) - **feat:** add float16 dtype support for `array/base/getter` [(#13223)](https://github.com/stdlib-js/stdlib/pull/13223) _(by Gururaj Gurram, Athan Reines)_
6870
- [`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)_
6971
- [`1428ba4`](https://github.com/stdlib-js/stdlib/commit/1428ba4e084c92135e0fe4d2568e7180de91731e) - **docs:** update related packages sections [(#13158)](https://github.com/stdlib-js/stdlib/pull/13158) _(by stdlib-bot)_
7072
- [`0fbbe42`](https://github.com/stdlib-js/stdlib/commit/0fbbe42ac5285b2fc13893c2c62667a59aedf272) - **feat:** add float16 dtype support to `array/zero-to` [(#13054)](https://github.com/stdlib-js/stdlib/pull/13054) _(by Gururaj Gurram, Athan Reines)_

‎base/getter/README.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,37 @@ arr = filled( 2.0, 10, 'float32' );
9797
v = getter( dtype( arr ) )( arr, 2 );
9898
// returns 2.0
9999

100-
arr = filled( 3, 10, 'int32' );
100+
arr = filled( 3.0, 10, 'float16' );
101101
v = getter( dtype( arr ) )( arr, 2 );
102-
// returns 3
102+
// returns 3.0
103103

104-
arr = filled( 4, 10, 'int16' );
104+
arr = filled( 4, 10, 'int32' );
105105
v = getter( dtype( arr ) )( arr, 2 );
106106
// returns 4
107107

108-
arr = filled( 5, 10, 'int8' );
108+
arr = filled( 5, 10, 'int16' );
109109
v = getter( dtype( arr ) )( arr, 2 );
110110
// returns 5
111111

112-
arr = filled( 6, 10, 'uint32' );
112+
arr = filled( 6, 10, 'int8' );
113113
v = getter( dtype( arr ) )( arr, 2 );
114114
// returns 6
115115

116-
arr = filled( 7, 10, 'uint16' );
116+
arr = filled( 7, 10, 'uint32' );
117117
v = getter( dtype( arr ) )( arr, 2 );
118118
// returns 7
119119

120-
arr = filled( 8, 10, 'uint8' );
120+
arr = filled( 8, 10, 'uint16' );
121121
v = getter( dtype( arr ) )( arr, 2 );
122122
// returns 8
123123

124-
arr = filled( 9, 10, 'uint8c' );
124+
arr = filled( 9, 10, 'uint8' );
125125
v = getter( dtype( arr ) )( arr, 2 );
126126
// returns 9
127+
128+
arr = filled( 10, 10, 'uint8c' );
129+
v = getter( dtype( arr ) )( arr, 2 );
130+
// returns 10
127131
```
128132

129133
</section>

‎base/getter/benchmark/benchmark.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,30 @@ bench( format( '%s:dtype=float32', pkg ), function benchmark( b ) {
133133
b.end();
134134
});
135135

136+
bench( format( '%s:dtype=float16', pkg ), function benchmark( b ) {
137+
var arr;
138+
var get;
139+
var i;
140+
var v;
141+
142+
arr = filledBy( 100, 'float16', rand );
143+
get = getter( dtype( arr ) );
144+
145+
b.tic();
146+
for ( i = 0; i < b.iterations; i++ ) {
147+
v = get( arr, i%arr.length );
148+
if ( v !== v ) {
149+
b.fail( 'should not return NaN' );
150+
}
151+
}
152+
b.toc();
153+
if ( isnan( v ) ) {
154+
b.fail( 'should not return NaN' );
155+
}
156+
b.pass( 'benchmark finished' );
157+
b.end();
158+
});
159+
136160
bench( format( '%s:dtype=int32', pkg ), function benchmark( b ) {
137161
var arr;
138162
var get;

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

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

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

23-
import { Collection } from '@stdlib/types/array';
23+
import { Collection, Float16Array } from '@stdlib/types/array';
2424

2525
/**
2626
* Returns an element from a `Float64Array`.
@@ -40,6 +40,15 @@ type GetFloat64 = ( arr: Float64Array, idx: number ) => number | void;
4040
*/
4141
type GetFloat32 = ( arr: Float32Array, idx: number ) => number | void;
4242

43+
/**
44+
* Returns an element from a `Float16Array`.
45+
*
46+
* @param arr - input array
47+
* @param idx - element index
48+
* @returns element value
49+
*/
50+
type GetFloat16 = ( arr: Float16Array, idx: number ) => number | void;
51+
4352
/**
4453
* Returns an element from an `Int32Array`.
4554
*
@@ -155,6 +164,23 @@ declare function getter( dtype: 'float64' ): GetFloat64;
155164
*/
156165
declare function getter( dtype: 'float32' ): GetFloat32;
157166

167+
/**
168+
* Returns an accessor function for retrieving an element from a `Float16Array`.
169+
*
170+
* @param dtype - data type
171+
* @returns accessor function
172+
*
173+
* @example
174+
* var Float16Array = require( '@stdlib/array/float16' );
175+
*
176+
* var arr = new Float16Array( [ 1, 2, 3, 4 ] );
177+
*
178+
* var get = getter( 'float16' );
179+
* var v = get( arr, 2 );
180+
* // returns 3.0
181+
*/
182+
declare function getter( dtype: 'float16' ): GetFloat16;
183+
158184
/**
159185
* Returns an accessor function for retrieving an element from an `Int32Array`.
160186
*

0 commit comments

Comments
 (0)