Skip to content

Commit 3582fd9

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

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+
- [`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)
1314
- [`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)
1415
- [`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)
1516
- [`e08bfd5`](https://github.com/stdlib-js/stdlib/commit/e08bfd50feecb0c5eef906ed97405b5b47cbce03) - add float16 dtype support to `ndarray/base/slice-from` [(#15524)](https://github.com/stdlib-js/stdlib/pull/15524)
@@ -129,6 +130,7 @@ A total of 4 issues were closed in this release:
129130

130131
<details>
131132

133+
- [`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)_
132134
- [`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)_
133135
- [`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)_
134136
- [`e08bfd5`](https://github.com/stdlib-js/stdlib/commit/e08bfd50feecb0c5eef906ed97405b5b47cbce03) - **feat:** add float16 dtype support to `ndarray/base/slice-from` [(#15524)](https://github.com/stdlib-js/stdlib/pull/15524) _(by Samarth Kolarkar)_

‎base/slice-dimension-from/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-from/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 shifted view of an input ndarray along a specified dimension.
@@ -102,6 +102,46 @@ declare function sliceDimensionFrom( x: float64ndarray, dim: number, start: numb
102102
*/
103103
declare function sliceDimensionFrom( x: float32ndarray, dim: number, start: number, strict: boolean, writable: boolean ): float32ndarray;
104104

105+
/**
106+
* Returns a shifted 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 start - starting index (inclusive)
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 = sliceDimensionFrom( x, 0, 1, false, false );
135+
* // returns <ndarray>
136+
*
137+
* sh = y.shape;
138+
* // returns [ 2, 2 ]
139+
*
140+
* arr = ndarray2array( y );
141+
* // returns [ [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
142+
*/
143+
declare function sliceDimensionFrom( x: float16ndarray, dim: number, start: number, strict: boolean, writable: boolean ): float16ndarray;
144+
105145
/**
106146
* Returns a shifted view of an input ndarray along a specified dimension.
107147
*

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

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

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

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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ tape( 'in non-strict mode, the function returns an empty array when a starting i
165165
values = [
166166
zeros( [ 1 ], { 'dtype': 'float64' } ),
167167
zeros( [ 1, 1 ], { 'dtype': 'float32' } ),
168+
zeros( [ 1, 1 ], { 'dtype': 'float16' } ),
168169
zeros( [ 1, 1, 1 ], { 'dtype': 'int32' } ),
169170
zeros( [ 1, 1, 1, 1 ], { 'dtype': 'uint32' } ),
170171
zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } )
@@ -177,6 +178,7 @@ tape( 'in non-strict mode, the function returns an empty array when a starting i
177178
20,
178179
20,
179180
20,
181+
20,
180182
10
181183
];
182184
for ( i = 0; i < values.length; i++ ) {
@@ -200,6 +202,7 @@ tape( 'in non-strict mode, the function returns an empty array when a starting i
200202
values = [
201203
zeros( [ 1 ], { 'dtype': 'float64' } ),
202204
zeros( [ 1, 1 ], { 'dtype': 'float32' } ),
205+
zeros( [ 1, 1 ], { 'dtype': 'float16' } ),
203206
zeros( [ 1, 1, 1 ], { 'dtype': 'int32' } ),
204207
zeros( [ 1, 1, 1, 1 ], { 'dtype': 'uint32' } ),
205208
zeros( [ 1, 1, 1, 1, 1 ], { 'dtype': 'complex128' } )
@@ -210,6 +213,7 @@ tape( 'in non-strict mode, the function returns an empty array when a starting i
210213
dim = [
211214
0,
212215
1,
216+
1,
213217
0,
214218
1,
215219
4
@@ -220,6 +224,7 @@ tape( 'in non-strict mode, the function returns an empty array when a starting i
220224
1,
221225
1,
222226
1,
227+
1,
223228
1
224229
];
225230
for ( i = 0; i < values.length; i++ ) {

0 commit comments

Comments
 (0)