Skip to content

Commit a3b4877

Browse files
committed
Auto-generated commit
1 parent 9a2ca1d commit a3b4877

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ A total of 24 issues were closed in this release:
498498

499499
<details>
500500

501+
- [`3091a38`](https://github.com/stdlib-js/stdlib/commit/3091a3891a9bc2755cde60001cc45a1168fca6d9) - **refactor:** use utility _(by Athan Reines)_
501502
- [`f043c89`](https://github.com/stdlib-js/stdlib/commit/f043c893ac0fe9392f7b764167899a482d84708e) - **feat:** add `ndarray/base/nullary-strided1d` [(#7772)](https://github.com/stdlib-js/stdlib/pull/7772) _(by Muhammad Haris, Athan Reines)_
502503
- [`3174a3b`](https://github.com/stdlib-js/stdlib/commit/3174a3b0243e1976487cd1dea54decec9caaa3f8) - **feat:** add `ndarray/base/any` [(#7640)](https://github.com/stdlib-js/stdlib/pull/7640) _(by Muhammad Haris, Athan Reines)_
503504
- [`3b77033`](https://github.com/stdlib-js/stdlib/commit/3b7703363c530e1d485912a441c9ef36b14640cd) - **docs:** update example _(by Athan Reines)_

base/broadcast-array/lib/main.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var getOffset = require( './../../../base/offset' );
2828
var getOrder = require( './../../../base/order' );
2929
var getDType = require( './../../../base/dtype' );
3030
var getData = require( './../../../base/data-buffer' );
31+
var zeros = require( '@stdlib/array/base/zeros' );
3132
var format = require( '@stdlib/string/format' );
3233

3334

@@ -106,11 +107,9 @@ function broadcastArray( arr, shape ) {
106107
if ( N < M ) {
107108
throw new Error( 'invalid argument. Cannot broadcast an array to a shape having fewer dimensions. Arrays can only be broadcasted to shapes having the same or more dimensions.' );
108109
}
109-
// Initialize a strides array...
110-
strides = [];
111-
for ( i = 0; i < N; i++ ) {
112-
strides.push( 0 );
113-
}
110+
// Initialize a strides array:
111+
strides = zeros( N );
112+
114113
// Determine the output array strides...
115114
st = getStrides( arr, false );
116115
for ( i = N-1; i >= 0; i-- ) {

0 commit comments

Comments
 (0)