Skip to content

Commit 7d8eeb9

Browse files
committed
Auto-generated commit
1 parent a417c21 commit 7d8eeb9

File tree

9 files changed

+75
-9
lines changed

9 files changed

+75
-9
lines changed

CHANGELOG.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-04-16)
7+
## Unreleased (2025-04-18)
88

99
<section class="packages">
1010

@@ -46,6 +46,7 @@
4646

4747
##### Bug Fixes
4848

49+
- [`07710f8`](https://github.com/stdlib-js/stdlib/commit/07710f849133f4414b37a19a96fb3ccdad7538d5) - check for duplicate indices
4950
- [`605c582`](https://github.com/stdlib-js/stdlib/commit/605c5828fe6efeae442d8df17d29404d2acb759f) - update error message
5051

5152
</section>
@@ -1066,6 +1067,28 @@ This release closes the following issue:
10661067

10671068
<!-- /.package -->
10681069

1070+
<section class="package" id="ndarray-empty-like-unreleased">
1071+
1072+
#### [@stdlib/ndarray/empty-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/empty-like)
1073+
1074+
<details>
1075+
1076+
<section class="bug-fixes">
1077+
1078+
##### Bug Fixes
1079+
1080+
- [`046926b`](https://github.com/stdlib-js/stdlib/commit/046926b9a0ad4643802944ef110b1cfe1eb488c9) - ensure support for zero-dimensional shapes
1081+
1082+
</section>
1083+
1084+
<!-- /.bug-fixes -->
1085+
1086+
</details>
1087+
1088+
</section>
1089+
1090+
<!-- /.package -->
1091+
10691092
<section class="package" id="ndarray-every-unreleased">
10701093

10711094
#### [@stdlib/ndarray/every](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/every)
@@ -1086,6 +1109,7 @@ This release closes the following issue:
10861109

10871110
##### Bug Fixes
10881111

1112+
- [`86632f3`](https://github.com/stdlib-js/stdlib/commit/86632f3d1a2de336941303b32e994c870bcaeb71) - check for duplicate indices
10891113
- [`0836dce`](https://github.com/stdlib-js/stdlib/commit/0836dce5df85cb2cc185c65ca839aa99f30eb9e1) - update error message
10901114
- [`6f61b2d`](https://github.com/stdlib-js/stdlib/commit/6f61b2dfab95f59ff05a07769b777f5012e1c193) - handle edge case when `dims=[]`
10911115

@@ -1457,6 +1481,28 @@ This release closes the following issue:
14571481

14581482
<!-- /.package -->
14591483

1484+
<section class="package" id="ndarray-zeros-like-unreleased">
1485+
1486+
#### [@stdlib/ndarray/zeros-like](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/zeros-like)
1487+
1488+
<details>
1489+
1490+
<section class="bug-fixes">
1491+
1492+
##### Bug Fixes
1493+
1494+
- [`f7bb91c`](https://github.com/stdlib-js/stdlib/commit/f7bb91c2aa3b31c86ddd57cfd3396632c78d42c0) - ensure support for zero-dimensional shapes
1495+
1496+
</section>
1497+
1498+
<!-- /.bug-fixes -->
1499+
1500+
</details>
1501+
1502+
</section>
1503+
1504+
<!-- /.package -->
1505+
14601506
</section>
14611507

14621508
<!-- /.packages -->
@@ -1519,6 +1565,14 @@ A total of 13 people contributed to this release. Thank you to the following con
15191565

15201566
<details>
15211567

1568+
- [`f7bb91c`](https://github.com/stdlib-js/stdlib/commit/f7bb91c2aa3b31c86ddd57cfd3396632c78d42c0) - **fix:** ensure support for zero-dimensional shapes _(by Athan Reines)_
1569+
- [`046926b`](https://github.com/stdlib-js/stdlib/commit/046926b9a0ad4643802944ef110b1cfe1eb488c9) - **fix:** ensure support for zero-dimensional shapes _(by Athan Reines)_
1570+
- [`b1d96c9`](https://github.com/stdlib-js/stdlib/commit/b1d96c95fce3e8692ec6cbb4436eacd1943a5528) - **refactor:** use assertion utility _(by Athan Reines)_
1571+
- [`f62c303`](https://github.com/stdlib-js/stdlib/commit/f62c303e990ecc605a34774772091dda14e3088f) - **refactor:** use assertion utility _(by Athan Reines)_
1572+
- [`86632f3`](https://github.com/stdlib-js/stdlib/commit/86632f3d1a2de336941303b32e994c870bcaeb71) - **fix:** check for duplicate indices _(by Athan Reines)_
1573+
- [`07710f8`](https://github.com/stdlib-js/stdlib/commit/07710f849133f4414b37a19a96fb3ccdad7538d5) - **fix:** check for duplicate indices _(by Athan Reines)_
1574+
- [`dcd9428`](https://github.com/stdlib-js/stdlib/commit/dcd9428900fbd2bdfe3505e71fa00ccd08a7efce) - **refactor:** fix argument _(by Athan Reines)_
1575+
- [`867f172`](https://github.com/stdlib-js/stdlib/commit/867f172f951619f7ca087c25f7944954198fabb0) - **refactor:** fix argument _(by Athan Reines)_
15221576
- [`9d6cd84`](https://github.com/stdlib-js/stdlib/commit/9d6cd84404f09e09f22721d4e3bd1d083b8f83b1) - **chore:** add TODO _(by Athan Reines)_
15231577
- [`35612e9`](https://github.com/stdlib-js/stdlib/commit/35612e9369b15f22fc8be80a9da56cf73aee05d8) - **chore:** add TODO _(by Athan Reines)_
15241578
- [`ca10e52`](https://github.com/stdlib-js/stdlib/commit/ca10e526a8d174acca07ea25631f3254a768690c) - **feat:** add `ndarray/base/unary-reduce-strided1d` _(by Athan Reines)_

empty-like/lib/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020

2121
// MODULES //
2222

23+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2324
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2425
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2526
var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives;
27+
var isEmptyCollection = require( '@stdlib/assert/is-empty-collection' );
2628
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2729
var shape2strides = require( './../../base/shape2strides' );
2830
var strides2offset = require( './../../base/strides2offset' );
@@ -98,10 +100,10 @@ function emptyLike( x ) {
98100
}
99101
if ( hasOwnProp( options, 'shape' ) ) {
100102
sh = options.shape;
101-
if ( typeof sh === 'number' ) {
103+
if ( isNumber( sh ) ) {
102104
sh = [ sh ];
103105
}
104-
if ( !isNonNegativeIntegerArray( sh ) ) {
106+
if ( !isNonNegativeIntegerArray( sh ) && !isEmptyCollection( sh ) ) { // eslint-disable-line max-len
105107
throw new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer or an array of nonnegative integers. Option: `%s`.', 'shape', sh ) );
106108
}
107109
} else {

empty/lib/main.js

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

2121
// MODULES //
2222

23+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2324
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2425
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2526
var isArrayLike = require( '@stdlib/assert/is-array-like' );
@@ -104,7 +105,7 @@ function empty( shape ) {
104105
dtype = DTYPE;
105106
order = ORDER;
106107
}
107-
if ( typeof shape === 'number' ) {
108+
if ( isNumber( shape ) ) {
108109
sh = [ shape ];
109110
} else if ( isArrayLike( shape ) ) {
110111
sh = shape;

every/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function every( x, options ) {
123123
});
124124

125125
// Reinterpret the output array as an "indexed" array to ensure faster element access:
126-
view = new ndarrayCtor( 'uint8', reinterpretBoolean( getData( y ), 0 ), shy, getStrides( y, 0 ), getOffset( y ), getOrder( y ) );
126+
view = new ndarrayCtor( 'uint8', reinterpretBoolean( getData( y ), 0 ), shy, getStrides( y, false ), getOffset( y ), getOrder( y ) );
127127

128128
// Perform the reduction:
129129
unaryReduceSubarray( base, [ x, view ], opts.dims );

every/lib/validate.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function validate( opts, ndims, options ) {
7373
if ( tmp === null ) {
7474
return new RangeError( format( 'invalid option. `%s` option contains an out-of-bounds dimension index. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
7575
}
76+
if ( tmp.length !== opts.dims.length ) {
77+
return new Error( format( 'invalid option. `%s` option contains duplicate indices. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
78+
}
7679
if ( tmp.length > ndims ) {
7780
return new RangeError( format( 'invalid option. `%s` option specifies more dimensions than exists in the input array. Number of dimensions: %d. Option: [%s].', ndims, join( opts.dims, ',' ) ) );
7881
}

includes/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function includes( x, searchElement, options ) {
153153
});
154154

155155
// Reinterpret the output array as an "indexed" array to ensure faster element access:
156-
view = new ndarrayCtor( 'uint8', reinterpretBoolean( getData( y ), 0 ), shy, getStrides( y, 0 ), getOffset( y ), getOrder( y ) );
156+
view = new ndarrayCtor( 'uint8', reinterpretBoolean( getData( y ), 0 ), shy, getStrides( y, false ), getOffset( y ), getOrder( y ) );
157157

158158
// Perform the reduction:
159159
unaryReduceSubarray( base, [ x, view, v ], opts.dims );

includes/lib/validate.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function validate( opts, ndims, options ) {
7373
if ( tmp === null ) {
7474
return new RangeError( format( 'invalid option. `%s` option contains an out-of-bounds dimension index. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
7575
}
76+
if ( tmp.length !== opts.dims.length ) {
77+
return new Error( format( 'invalid option. `%s` option contains duplicate indices. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
78+
}
7679
if ( tmp.length > ndims ) {
7780
return new RangeError( format( 'invalid option. `%s` option specifies more dimensions than exists in the input array. Number of dimensions: %d. Option: [%s].', ndims, join( opts.dims, ',' ) ) );
7881
}

zeros-like/lib/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020

2121
// MODULES //
2222

23+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2324
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2425
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2526
var isNonNegativeIntegerArray = require( '@stdlib/assert/is-nonnegative-integer-array' ).primitives;
27+
var isEmptyCollection = require( '@stdlib/assert/is-empty-collection' );
2628
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2729
var shape2strides = require( './../../base/shape2strides' );
2830
var strides2offset = require( './../../base/strides2offset' );
@@ -98,10 +100,10 @@ function zerosLike( x ) {
98100
}
99101
if ( hasOwnProp( options, 'shape' ) ) {
100102
sh = options.shape;
101-
if ( typeof sh === 'number' ) {
103+
if ( isNumber( sh ) ) {
102104
sh = [ sh ];
103105
}
104-
if ( !isNonNegativeIntegerArray( sh ) ) {
106+
if ( !isNonNegativeIntegerArray( sh ) && !isEmptyCollection( sh ) ) { // eslint-disable-line max-len
105107
throw new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer or an array of nonnegative integers. Option: `%s`.', 'shape', sh ) );
106108
}
107109
} else {

zeros/lib/main.js

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

2121
// MODULES //
2222

23+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2324
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2425
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2526
var isArrayLike = require( '@stdlib/assert/is-array-like' );
@@ -107,7 +108,7 @@ function zeros( shape ) {
107108
dtype = DTYPE;
108109
order = ORDER;
109110
}
110-
if ( typeof shape === 'number' ) {
111+
if ( isNumber( shape ) ) {
111112
sh = [ shape ];
112113
} else if ( isArrayLike( shape ) ) {
113114
sh = shape;

0 commit comments

Comments
 (0)