Skip to content

Commit 21d1fe2

Browse files
committed
Auto-generated commit
1 parent 6af1003 commit 21d1fe2

File tree

5 files changed

+17
-109
lines changed

5 files changed

+17
-109
lines changed

CHANGELOG.md

Lines changed: 5 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-09-13)
7+
## Unreleased (2025-09-14)
88

99
<section class="features">
1010

@@ -519,6 +519,10 @@ A total of 24 issues were closed in this release:
519519

520520
<details>
521521

522+
- [`1e5c77a`](https://github.com/stdlib-js/stdlib/commit/1e5c77a53d8b81c99ca0be177b1e828dbfc12173) - **refactor:** use array utility _(by Athan Reines)_
523+
- [`351db28`](https://github.com/stdlib-js/stdlib/commit/351db2889ebd45eb0dc55efd4edb1e4d6e20daa7) - **refactor:** use array utility _(by Athan Reines)_
524+
- [`01bc84c`](https://github.com/stdlib-js/stdlib/commit/01bc84cc252dbb2e46ff575e10ceb45a9a19cb92) - **refactor:** use array utility _(by Athan Reines)_
525+
- [`997af88`](https://github.com/stdlib-js/stdlib/commit/997af882f60adc86118f03b0af433d0b2df78799) - **refactor:** use array utility _(by Athan Reines)_
522526
- [`cc715fa`](https://github.com/stdlib-js/stdlib/commit/cc715fa508b46f9bc8fbf516ce5185050adc4cf8) - **feat:** add `ndarray/base/binary-reduce-strided1d-dispatch-factory` [(#7950)](https://github.com/stdlib-js/stdlib/pull/7950) _(by Gururaj Gurram, Athan Reines, stdlib-bot)_
523527
- [`626b52b`](https://github.com/stdlib-js/stdlib/commit/626b52bc5f30d90237d82055095814a5f6e75546) - **docs:** remove comma _(by Athan Reines)_
524528
- [`0b84dbb`](https://github.com/stdlib-js/stdlib/commit/0b84dbba9791d2033079cecb12a33f9e66640e54) - **docs:** update description _(by Athan Reines)_

base/binary-reduce-strided1d-dispatch/lib/main.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var takeIndexed = require( '@stdlib/array/base/take-indexed' );
5151
var zeroTo = require( '@stdlib/array/base/zero-to' );
5252
var join = require( '@stdlib/array/base/join' );
5353
var copy = require( '@stdlib/array/base/copy' );
54+
var insertAt = require( '@stdlib/array/base/insert-at' );
5455
var everyBy = require( '@stdlib/array/base/every-by' );
5556
var objectAssign = require( '@stdlib/object/assign' );
5657
var format = require( '@stdlib/string/format' );
@@ -85,31 +86,6 @@ function types2enums( types ) {
8586
return out;
8687
}
8788

88-
/**
89-
* Reorders a list of ndarrays such that the output ndarray is the third ndarray argument when passing along to a resolved lower-level strided function.
90-
*
91-
* @private
92-
* @param {Array<ndarray>} arrays - list of input ndarrays
93-
* @param {ndarray} output - output ndarray
94-
* @returns {Array<ndarray>} reordered list
95-
*/
96-
function reorder( arrays, output ) { // TODO: consider replacing with an `array/base/*` utility which expands an input array by inserting a specified value at a specified index and returns a new array
97-
var out;
98-
var i;
99-
var j;
100-
101-
out = [];
102-
for ( i = 0, j = 0; i <= arrays.length; i++ ) {
103-
if ( i === 2 ) {
104-
out.push( output );
105-
} else {
106-
out.push( arrays[ j ] );
107-
j += 1;
108-
}
109-
}
110-
return out;
111-
}
112-
11389

11490
// MAIN //
11591

@@ -407,7 +383,7 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'apply', function apply( x, y )
407383
f = this._table.default;
408384
}
409385
// Perform the reduction:
410-
binaryReduceStrided1d( f, reorder( args, z ), opts.dims );
386+
binaryReduceStrided1d( f, insertAt( args, 2, z ), opts.dims );
411387

412388
// Check whether we need to reinsert singleton dimensions which can be useful for broadcasting the returned output array to the shape of the original input array...
413389
if ( opts.keepdims ) {
@@ -597,7 +573,7 @@ setReadOnly( BinaryStrided1dDispatch.prototype, 'assign', function assign( x, y
597573
f = this._table.default;
598574
}
599575
// Perform the reduction:
600-
binaryReduceStrided1d( f, reorder( args, z ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
576+
binaryReduceStrided1d( f, insertAt( args, 2, z ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
601577

602578
return z;
603579
});

base/unary-reduce-strided1d-dispatch-by/lib/main.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var takeIndexed = require( '@stdlib/array/base/take-indexed' );
5151
var zeroTo = require( '@stdlib/array/base/zero-to' );
5252
var join = require( '@stdlib/array/base/join' );
5353
var copy = require( '@stdlib/array/base/copy' );
54+
var insertAt = require( '@stdlib/array/base/insert-at' );
5455
var everyBy = require( '@stdlib/array/base/every-by' );
5556
var objectAssign = require( '@stdlib/object/assign' );
5657
var format = require( '@stdlib/string/format' );
@@ -79,31 +80,6 @@ function types2enums( types ) {
7980
return out;
8081
}
8182

82-
/**
83-
* Reorders a list of ndarrays such that the output ndarray is the second ndarray argument when passing along to a resolved lower-level strided function.
84-
*
85-
* @private
86-
* @param {Array<ndarray>} arrays - list of input ndarrays
87-
* @param {ndarray} output - output ndarray
88-
* @returns {Array<ndarray>} reordered list
89-
*/
90-
function reorder( arrays, output ) { // TODO: consider replacing with an `array/base/*` utility which expands an input array by inserting a specified value at a specified index and returns a new array
91-
var out;
92-
var i;
93-
var j;
94-
95-
out = [];
96-
for ( i = 0, j = 0; i <= arrays.length; i++ ) {
97-
if ( i === 1 ) {
98-
out.push( output );
99-
} else {
100-
out.push( arrays[ j ] );
101-
j += 1;
102-
}
103-
}
104-
return out;
105-
}
106-
10783

10884
// MAIN //
10985

@@ -402,7 +378,7 @@ setReadOnly( UnaryStrided1dDispatchBy.prototype, 'apply', function apply( x ) {
402378
f = this._table.default;
403379
}
404380
// Perform the reduction:
405-
unaryReduceStrided1dBy( f, reorder( args, y ), opts.dims, clbk, thisArg );
381+
unaryReduceStrided1dBy( f, insertAt( args, 1, y ), opts.dims, clbk, thisArg );
406382

407383
// Check whether we need to reinsert singleton dimensions which can be useful for broadcasting the returned output array to the shape of the original input array...
408384
if ( opts.keepdims ) {
@@ -589,7 +565,7 @@ setReadOnly( UnaryStrided1dDispatchBy.prototype, 'assign', function assign( x )
589565
f = this._table.default;
590566
}
591567
// Perform the reduction:
592-
unaryReduceStrided1dBy( f, reorder( args, y ), opts.dims, clbk, thisArg ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
568+
unaryReduceStrided1dBy( f, insertAt( args, 1, y ), opts.dims, clbk, thisArg ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
593569

594570
return y;
595571
});

base/unary-reduce-strided1d-dispatch/lib/main.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var takeIndexed = require( '@stdlib/array/base/take-indexed' );
5151
var zeroTo = require( '@stdlib/array/base/zero-to' );
5252
var join = require( '@stdlib/array/base/join' );
5353
var copy = require( '@stdlib/array/base/copy' );
54+
var insertAt = require( '@stdlib/array/base/insert-at' );
5455
var everyBy = require( '@stdlib/array/base/every-by' );
5556
var objectAssign = require( '@stdlib/object/assign' );
5657
var format = require( '@stdlib/string/format' );
@@ -79,31 +80,6 @@ function types2enums( types ) {
7980
return out;
8081
}
8182

82-
/**
83-
* Reorders a list of ndarrays such that the output ndarray is the second ndarray argument when passing along to a resolved lower-level strided function.
84-
*
85-
* @private
86-
* @param {Array<ndarray>} arrays - list of input ndarrays
87-
* @param {ndarray} output - output ndarray
88-
* @returns {Array<ndarray>} reordered list
89-
*/
90-
function reorder( arrays, output ) { // TODO: consider replacing with an `array/base/*` utility which expands an input array by inserting a specified value at a specified index and returns a new array
91-
var out;
92-
var i;
93-
var j;
94-
95-
out = [];
96-
for ( i = 0, j = 0; i <= arrays.length; i++ ) {
97-
if ( i === 1 ) {
98-
out.push( output );
99-
} else {
100-
out.push( arrays[ j ] );
101-
j += 1;
102-
}
103-
}
104-
return out;
105-
}
106-
10783

10884
// MAIN //
10985

@@ -353,7 +329,7 @@ setReadOnly( UnaryStrided1dDispatch.prototype, 'apply', function apply( x ) {
353329
f = this._table.default;
354330
}
355331
// Perform the reduction:
356-
unaryReduceStrided1d( f, reorder( args, y ), opts.dims );
332+
unaryReduceStrided1d( f, insertAt( args, 1, y ), opts.dims );
357333

358334
// Check whether we need to reinsert singleton dimensions which can be useful for broadcasting the returned output array to the shape of the original input array...
359335
if ( opts.keepdims ) {
@@ -504,7 +480,7 @@ setReadOnly( UnaryStrided1dDispatch.prototype, 'assign', function assign( x ) {
504480
f = this._table.default;
505481
}
506482
// Perform the reduction:
507-
unaryReduceStrided1d( f, reorder( args, y ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
483+
unaryReduceStrided1d( f, insertAt( args, 1, y ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
508484

509485
return y;
510486
});

base/unary-strided1d-dispatch/lib/main.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var empty = require( './../../../empty' );
4848
var zeroTo = require( '@stdlib/array/base/zero-to' );
4949
var join = require( '@stdlib/array/base/join' );
5050
var copy = require( '@stdlib/array/base/copy' );
51+
var insertAt = require( '@stdlib/array/base/insert-at' );
5152
var everyBy = require( '@stdlib/array/base/every-by' );
5253
var objectAssign = require( '@stdlib/object/assign' );
5354
var format = require( '@stdlib/string/format' );
@@ -76,31 +77,6 @@ function types2enums( types ) {
7677
return out;
7778
}
7879

79-
/**
80-
* Reorders a list of ndarrays such that the output ndarray is the second ndarray argument when passing along to a resolved lower-level strided function.
81-
*
82-
* @private
83-
* @param {Array<ndarray>} arrays - list of input ndarrays
84-
* @param {ndarray} output - output ndarray
85-
* @returns {Array<ndarray>} reordered list
86-
*/
87-
function reorder( arrays, output ) { // TODO: consider replacing with an `array/base/*` utility which expands an input array by inserting a specified value at a specified index and returns a new array
88-
var out;
89-
var i;
90-
var j;
91-
92-
out = [];
93-
for ( i = 0, j = 0; i <= arrays.length; i++ ) {
94-
if ( i === 1 ) {
95-
out.push( output );
96-
} else {
97-
out.push( arrays[ j ] );
98-
j += 1;
99-
}
100-
}
101-
return out;
102-
}
103-
10480

10581
// MAIN //
10682

@@ -354,7 +330,7 @@ setReadOnly( UnaryStrided1dDispatch.prototype, 'apply', function apply( x ) {
354330
f = this._table.default;
355331
}
356332
// Perform operation:
357-
this._apply( f, reorder( args, y ), opts.dims );
333+
this._apply( f, insertAt( args, 1, y ), opts.dims );
358334

359335
return y;
360336
});
@@ -502,7 +478,7 @@ setReadOnly( UnaryStrided1dDispatch.prototype, 'assign', function assign( x ) {
502478
f = this._table.default;
503479
}
504480
// Perform operation:
505-
this._apply( f, reorder( args, y ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
481+
this._apply( f, insertAt( args, 1, y ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)
506482

507483
return y;
508484
});

0 commit comments

Comments
 (0)