Skip to content

Commit db13d1b

Browse files
committed
Auto-generated commit
1 parent 3582fd9 commit db13d1b

5 files changed

Lines changed: 70 additions & 1 deletion

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+
- [`736ac5e`](https://github.com/stdlib-js/stdlib/commit/736ac5eb4396e350e060df6008acaffb1b8c994a) - add float16 dtype support to `ndarray/base/slice-dimension-to` [(#15530)](https://github.com/stdlib-js/stdlib/pull/15530)
1314
- [`dd7e84b`](https://github.com/stdlib-js/stdlib/commit/dd7e84bf3221965bfc4a985abaed16d01a25b67b) - add float16 dtype support to `ndarray/base/slice-dimension-from` [(#15529)](https://github.com/stdlib-js/stdlib/pull/15529)
1415
- [`4d16cdd`](https://github.com/stdlib-js/stdlib/commit/4d16cdd8dbff71baa354d084f6b7a41713531141) - add float16 dtype support to `ndarray/base/slice-dimension` [(#15527)](https://github.com/stdlib-js/stdlib/pull/15527)
1516
- [`af5669c`](https://github.com/stdlib-js/stdlib/commit/af5669ca33f3f6e54f761853d1ed040d24f7012c) - add float16 dtype support to `ndarray/base/slice-assign` [(#15525)](https://github.com/stdlib-js/stdlib/pull/15525)
@@ -130,6 +131,7 @@ A total of 4 issues were closed in this release:
130131

131132
<details>
132133

134+
- [`736ac5e`](https://github.com/stdlib-js/stdlib/commit/736ac5eb4396e350e060df6008acaffb1b8c994a) - **feat:** add float16 dtype support to `ndarray/base/slice-dimension-to` [(#15530)](https://github.com/stdlib-js/stdlib/pull/15530) _(by Samarth Kolarkar)_
133135
- [`dd7e84b`](https://github.com/stdlib-js/stdlib/commit/dd7e84bf3221965bfc4a985abaed16d01a25b67b) - **feat:** add float16 dtype support to `ndarray/base/slice-dimension-from` [(#15529)](https://github.com/stdlib-js/stdlib/pull/15529) _(by Samarth Kolarkar)_
134136
- [`4d16cdd`](https://github.com/stdlib-js/stdlib/commit/4d16cdd8dbff71baa354d084f6b7a41713531141) - **feat:** add float16 dtype support to `ndarray/base/slice-dimension` [(#15527)](https://github.com/stdlib-js/stdlib/pull/15527) _(by Samarth Kolarkar)_
135137
- [`af5669c`](https://github.com/stdlib-js/stdlib/commit/af5669ca33f3f6e54f761853d1ed040d24f7012c) - **feat:** add float16 dtype support to `ndarray/base/slice-assign` [(#15525)](https://github.com/stdlib-js/stdlib/pull/15525) _(by Samarth Kolarkar)_

‎base/slice-dimension-to/benchmark/benchmark.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ bench( format( '%s::1d,base', pkg ), function benchmark( b ) {
4040
values = [
4141
baseEmpty( 'float64', [ 2 ], 'row-major' ),
4242
baseEmpty( 'float32', [ 2 ], 'row-major' ),
43+
baseEmpty( 'float16', [ 2 ], 'row-major' ),
4344
baseEmpty( 'int32', [ 2 ], 'row-major' ),
4445
baseEmpty( 'complex128', [ 2 ], 'row-major' ),
4546
baseEmpty( 'generic', [ 2 ], 'row-major' )
@@ -72,6 +73,7 @@ bench( format( '%s::1d,non-base', pkg ), function benchmark( b ) {
7273
values = [
7374
empty( [ 2 ], { 'dtype': 'float64' } ),
7475
empty( [ 2 ], { 'dtype': 'float32' } ),
76+
empty( [ 2 ], { 'dtype': 'float16' } ),
7577
empty( [ 2 ], { 'dtype': 'int32' } ),
7678
empty( [ 2 ], { 'dtype': 'complex128' } ),
7779
empty( [ 2 ], { 'dtype': 'generic' } )
@@ -105,6 +107,7 @@ bench( format( '%s::1d,base,out-of-bounds', pkg ), function benchmark( b ) {
105107
values = [
106108
baseEmpty( 'float64', [ 2 ], 'row-major' ),
107109
baseEmpty( 'float32', [ 2 ], 'row-major' ),
110+
baseEmpty( 'float16', [ 2 ], 'row-major' ),
108111
baseEmpty( 'int32', [ 2 ], 'row-major' ),
109112
baseEmpty( 'complex128', [ 2 ], 'row-major' ),
110113
baseEmpty( 'generic', [ 2 ], 'row-major' )
@@ -137,6 +140,7 @@ bench( format( '%s::1d,non-base,out-of-bounds', pkg ), function benchmark( b ) {
137140
values = [
138141
empty( [ 2 ], { 'dtype': 'float64' } ),
139142
empty( [ 2 ], { 'dtype': 'float32' } ),
143+
empty( [ 2 ], { 'dtype': 'float16' } ),
140144
empty( [ 2 ], { 'dtype': 'int32' } ),
141145
empty( [ 2 ], { 'dtype': 'complex128' } ),
142146
empty( [ 2 ], { 'dtype': 'generic' } )
@@ -170,6 +174,7 @@ bench( format( '%s::2d,base', pkg ), function benchmark( b ) {
170174
values = [
171175
baseEmpty( 'float64', [ 2, 2 ], 'row-major' ),
172176
baseEmpty( 'float32', [ 2, 2 ], 'row-major' ),
177+
baseEmpty( 'float16', [ 2, 2 ], 'row-major' ),
173178
baseEmpty( 'int32', [ 2, 2 ], 'row-major' ),
174179
baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ),
175180
baseEmpty( 'generic', [ 2, 2 ], 'row-major' )
@@ -202,6 +207,7 @@ bench( format( '%s::2d,non-base', pkg ), function benchmark( b ) {
202207
values = [
203208
empty( [ 2, 2 ], { 'dtype': 'float64' } ),
204209
empty( [ 2, 2 ], { 'dtype': 'float32' } ),
210+
empty( [ 2, 2 ], { 'dtype': 'float16' } ),
205211
empty( [ 2, 2 ], { 'dtype': 'int32' } ),
206212
empty( [ 2, 2 ], { 'dtype': 'complex128' } ),
207213
empty( [ 2, 2 ], { 'dtype': 'generic' } )
@@ -235,6 +241,7 @@ bench( format( '%s::2d,base,out-of-bounds', pkg ), function benchmark( b ) {
235241
values = [
236242
baseEmpty( 'float64', [ 2, 2 ], 'row-major' ),
237243
baseEmpty( 'float32', [ 2, 2 ], 'row-major' ),
244+
baseEmpty( 'float16', [ 2, 2 ], 'row-major' ),
238245
baseEmpty( 'int32', [ 2, 2 ], 'row-major' ),
239246
baseEmpty( 'complex128', [ 2, 2 ], 'row-major' ),
240247
baseEmpty( 'generic', [ 2, 2 ], 'row-major' )
@@ -267,6 +274,7 @@ bench( format( '%s::2d,non-base,out-of-bounds', pkg ), function benchmark( b ) {
267274
values = [
268275
empty( [ 2, 2 ], { 'dtype': 'float64' } ),
269276
empty( [ 2, 2 ], { 'dtype': 'float32' } ),
277+
empty( [ 2, 2 ], { 'dtype': 'float16' } ),
270278
empty( [ 2, 2 ], { 'dtype': 'int32' } ),
271279
empty( [ 2, 2 ], { 'dtype': 'complex128' } ),
272280
empty( [ 2, 2 ], { 'dtype': 'generic' } )
@@ -300,6 +308,7 @@ bench( format( '%s::3d,base', pkg ), function benchmark( b ) {
300308
values = [
301309
baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ),
302310
baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ),
311+
baseEmpty( 'float16', [ 2, 2, 2 ], 'row-major' ),
303312
baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ),
304313
baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ),
305314
baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' )
@@ -332,6 +341,7 @@ bench( format( '%s::3d,non-base', pkg ), function benchmark( b ) {
332341
values = [
333342
empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ),
334343
empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ),
344+
empty( [ 2, 2, 2 ], { 'dtype': 'float16' } ),
335345
empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ),
336346
empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ),
337347
empty( [ 2, 2, 2 ], { 'dtype': 'generic' } )
@@ -365,6 +375,7 @@ bench( format( '%s::3d,base,out-of-bounds', pkg ), function benchmark( b ) {
365375
values = [
366376
baseEmpty( 'float64', [ 2, 2, 2 ], 'row-major' ),
367377
baseEmpty( 'float32', [ 2, 2, 2 ], 'row-major' ),
378+
baseEmpty( 'float16', [ 2, 2, 2 ], 'row-major' ),
368379
baseEmpty( 'int32', [ 2, 2, 2 ], 'row-major' ),
369380
baseEmpty( 'complex128', [ 2, 2, 2 ], 'row-major' ),
370381
baseEmpty( 'generic', [ 2, 2, 2 ], 'row-major' )
@@ -397,6 +408,7 @@ bench( format( '%s::3d,non-base,out-of-bounds', pkg ), function benchmark( b ) {
397408
values = [
398409
empty( [ 2, 2, 2 ], { 'dtype': 'float64' } ),
399410
empty( [ 2, 2, 2 ], { 'dtype': 'float32' } ),
411+
empty( [ 2, 2, 2 ], { 'dtype': 'float16' } ),
400412
empty( [ 2, 2, 2 ], { 'dtype': 'int32' } ),
401413
empty( [ 2, 2, 2 ], { 'dtype': 'complex128' } ),
402414
empty( [ 2, 2, 2 ], { 'dtype': 'generic' } )
@@ -430,6 +442,7 @@ bench( format( '%s::4d,base', pkg ), function benchmark( b ) {
430442
values = [
431443
baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ),
432444
baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ),
445+
baseEmpty( 'float16', [ 2, 2, 2, 2 ], 'row-major' ),
433446
baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ),
434447
baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ),
435448
baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' )
@@ -462,6 +475,7 @@ bench( format( '%s::4d,non-base', pkg ), function benchmark( b ) {
462475
values = [
463476
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
464477
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
478+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float16' } ),
465479
empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
466480
empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
467481
empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } )
@@ -495,6 +509,7 @@ bench( format( '%s::4d,base,out-of-bounds', pkg ), function benchmark( b ) {
495509
values = [
496510
baseEmpty( 'float64', [ 2, 2, 2, 2 ], 'row-major' ),
497511
baseEmpty( 'float32', [ 2, 2, 2, 2 ], 'row-major' ),
512+
baseEmpty( 'float16', [ 2, 2, 2, 2 ], 'row-major' ),
498513
baseEmpty( 'int32', [ 2, 2, 2, 2 ], 'row-major' ),
499514
baseEmpty( 'complex128', [ 2, 2, 2, 2 ], 'row-major' ),
500515
baseEmpty( 'generic', [ 2, 2, 2, 2 ], 'row-major' )
@@ -527,6 +542,7 @@ bench( format( '%s::4d,non-base,out-of-bounds', pkg ), function benchmark( b ) {
527542
values = [
528543
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
529544
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
545+
empty( [ 2, 2, 2, 2 ], { 'dtype': 'float16' } ),
530546
empty( [ 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
531547
empty( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
532548
empty( [ 2, 2, 2, 2 ], { 'dtype': 'generic' } )
@@ -560,6 +576,7 @@ bench( format( '%s::5d,base', pkg ), function benchmark( b ) {
560576
values = [
561577
baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ),
562578
baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
579+
baseEmpty( 'float16', [ 2, 2, 2, 2, 2 ], 'row-major' ),
563580
baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
564581
baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ),
565582
baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' )
@@ -592,6 +609,7 @@ bench( format( '%s::5d,non-base', pkg ), function benchmark( b ) {
592609
values = [
593610
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
594611
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
612+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float16' } ),
595613
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
596614
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
597615
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } )
@@ -625,6 +643,7 @@ bench( format( '%s::5d,base,out-of-bounds', pkg ), function benchmark( b ) {
625643
values = [
626644
baseEmpty( 'float64', [ 2, 2, 2, 2, 2 ], 'row-major' ),
627645
baseEmpty( 'float32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
646+
baseEmpty( 'float16', [ 2, 2, 2, 2, 2 ], 'row-major' ),
628647
baseEmpty( 'int32', [ 2, 2, 2, 2, 2 ], 'row-major' ),
629648
baseEmpty( 'complex128', [ 2, 2, 2, 2, 2 ], 'row-major' ),
630649
baseEmpty( 'generic', [ 2, 2, 2, 2, 2 ], 'row-major' )
@@ -657,6 +676,7 @@ bench( format( '%s::5d,non-base,out-of-bounds', pkg ), function benchmark( b ) {
657676
values = [
658677
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' } ),
659678
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' } ),
679+
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float16' } ),
660680
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' } ),
661681
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' } ),
662682
empty( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' } )

‎base/slice-dimension-to/docs/types/index.d.ts‎

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

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

23-
import { typedndarray, genericndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray';
23+
import { typedndarray, genericndarray, float64ndarray, float32ndarray, float16ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray';
2424

2525
/**
2626
* Returns a truncated view of an input ndarray along a specified dimension.
@@ -102,6 +102,46 @@ declare function sliceDimensionTo( x: float64ndarray, dim: number, stop: number,
102102
*/
103103
declare function sliceDimensionTo( x: float32ndarray, dim: number, stop: number, strict: boolean, writable: boolean ): float32ndarray;
104104

105+
/**
106+
* Returns a truncated view of an input ndarray along a specified dimension.
107+
*
108+
* @param x - input array
109+
* @param dim - index of dimension to slice
110+
* @param stop - ending index (exclusive)
111+
* @param strict - boolean indicating whether to enforce strict bounds checking
112+
* @param writable - boolean indicating whether a returned array should be writable
113+
* @returns output array
114+
*
115+
* @example
116+
* var typedarray = require( '@stdlib/array/typed' );
117+
* var ndarray = require( '@stdlib/ndarray/ctor' );
118+
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
119+
*
120+
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float16' );
121+
* var shape = [ 3, 2 ];
122+
* var strides = [ 2, 1 ];
123+
* var offset = 0;
124+
*
125+
* var x = ndarray( 'float16', buffer, shape, strides, offset, 'row-major' );
126+
* // returns <ndarray>
127+
*
128+
* var sh = x.shape;
129+
* // returns [ 3, 2 ]
130+
*
131+
* var arr = ndarray2array( x );
132+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
133+
*
134+
* var y = sliceDimensionTo( x, 0, 2, false, false );
135+
* // returns <ndarray>
136+
*
137+
* sh = y.shape;
138+
* // returns [ 2, 2 ]
139+
*
140+
* arr = ndarray2array( y );
141+
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]
142+
*/
143+
declare function sliceDimensionTo( x: float16ndarray, dim: number, stop: number, strict: boolean, writable: boolean ): float16ndarray;
144+
105145
/**
106146
* Returns a truncated view of an input ndarray along a specified dimension.
107147
*

‎base/slice-dimension-to/docs/types/test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import sliceDimensionTo = require( './index' );
3030

3131
sliceDimensionTo( empty( 'float64', sh, order ), 1, s, false, false ); // $ExpectType float64ndarray
3232
sliceDimensionTo( empty( 'float32', sh, order ), 1, s, false, false ); // $ExpectType float32ndarray
33+
sliceDimensionTo( empty( 'float16', sh, order ), 1, s, false, false ); // $ExpectType float16ndarray
3334
sliceDimensionTo( empty( 'complex128', sh, order ), 1, s, false, false ); // $ExpectType complex128ndarray
3435
sliceDimensionTo( empty( 'complex64', sh, order ), 1, s, false, false ); // $ExpectType complex64ndarray
3536
sliceDimensionTo( empty( 'int32', sh, order ), 1, s, false, false ); // $ExpectType int32ndarray
@@ -42,6 +43,7 @@ import sliceDimensionTo = require( './index' );
4243

4344
sliceDimensionTo( empty( 'float64', sh, order ), 1, s, true, true ); // $ExpectType float64ndarray
4445
sliceDimensionTo( empty( 'float32', sh, order ), 1, s, true, true ); // $ExpectType float32ndarray
46+
sliceDimensionTo( empty( 'float16', sh, order ), 1, s, true, true ); // $ExpectType float16ndarray
4547
sliceDimensionTo( empty( 'complex128', sh, order ), 1, s, true, true ); // $ExpectType complex128ndarray
4648
sliceDimensionTo( empty( 'complex64', sh, order ), 1, s, true, true ); // $ExpectType complex64ndarray
4749
sliceDimensionTo( empty( 'int32', sh, order ), 1, s, true, true ); // $ExpectType int32ndarray

‎base/slice-dimension-to/test/test.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ tape( 'in non-strict mode, the function returns an empty array when an ending in
166166
values = [
167167
zeros( [ 1 ], { 'dtype': 'float64' } ),
168168
zeros( [ 1, 1 ], { 'dtype': 'float32' } ),
169+
zeros( [ 1, 1 ], { 'dtype': 'float16' } ),
169170
zeros( [ 1, 1, 1 ], { 'dtype': 'int32' } ),
170171
zeros( [ 1, 1, 1, 1 ], { 'dtype': 'uint32' } ),
171172
zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } )
@@ -178,6 +179,7 @@ tape( 'in non-strict mode, the function returns an empty array when an ending in
178179
-20,
179180
-20,
180181
-20,
182+
-20,
181183
-10
182184
];
183185
for ( i = 0; i < values.length; i++ ) {
@@ -201,6 +203,7 @@ tape( 'the function returns an empty array when an ending index is the first ele
201203
values = [
202204
zeros( [ 1 ], { 'dtype': 'float64' } ),
203205
zeros( [ 1, 1 ], { 'dtype': 'float32' } ),
206+
zeros( [ 1, 1 ], { 'dtype': 'float16' } ),
204207
zeros( [ 1, 1, 1 ], { 'dtype': 'int32' } ),
205208
zeros( [ 1, 1, 1, 1 ], { 'dtype': 'uint32' } ),
206209
zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } )
@@ -211,6 +214,7 @@ tape( 'the function returns an empty array when an ending index is the first ele
211214
dim = [
212215
0,
213216
1,
217+
1,
214218
0,
215219
1,
216220
4
@@ -221,6 +225,7 @@ tape( 'the function returns an empty array when an ending index is the first ele
221225
0,
222226
0,
223227
0,
228+
0,
224229
0
225230
];
226231
for ( i = 0; i < values.length; i++ ) {

0 commit comments

Comments
 (0)