Skip to content

Commit 62b103a

Browse files
committed
Auto-generated commit
1 parent 5166056 commit 62b103a

13 files changed

Lines changed: 253 additions & 233 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<details>
2424

25+
- [`016b07f`](https://github.com/stdlib-js/stdlib/commit/016b07f8610e21332af7bfbc38afbacdbeac8583) - **refactor:** rename/reorder parameters _(by Athan Reines)_
2526
- [`f40ccb7`](https://github.com/stdlib-js/stdlib/commit/f40ccb75929e92538b8c366145589addccdaafbe) - **feat:** add `ndarray/base/ternary-loop-interchange-order` [(#9499)](https://github.com/stdlib-js/stdlib/pull/9499) _(by Muhammad Haris, Athan Reines)_
2627

2728
</details>

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ To view installation and usage instructions specific to each branch build, be su
7373
var ternaryLoopOrder = require( '@stdlib/ndarray-base-binary-loop-interchange-order' );
7474
```
7575

76-
#### ternaryLoopOrder( shape, stridesW, stridesX, stridesY, stridesZ )
76+
#### ternaryLoopOrder( shape, stridesX, stridesY, stridesZ, stridesW )
7777

7878
Reorders [ndarray][@stdlib/ndarray/ctor] dimensions and associated strides for [loop interchange][loop-interchange].
7979

@@ -82,25 +82,25 @@ Reorders [ndarray][@stdlib/ndarray/ctor] dimensions and associated strides for [
8282
var shape = [ 2, 2 ];
8383

8484
// Define the strides for the input arrays:
85-
var stridesW = [ 2, 1 ]; // row-major
86-
var stridesX = [ 4, 2 ]; // row-major
87-
var stridesY = [ 1, 2 ]; // column-major
85+
var stridesX = [ 2, 1 ]; // row-major
86+
var stridesY = [ 4, 2 ]; // row-major
87+
var stridesZ = [ 1, 2 ]; // column-major
8888

8989
// Define the strides for the output array:
90-
var stridesZ = [ 1, 2 ]; // column-major
90+
var stridesW = [ 1, 2 ]; // column-major
9191

9292
// Resolve the loop interchange order:
93-
var o = ternaryLoopOrder( shape, stridesW, stridesX, stridesY, stridesZ );
93+
var o = ternaryLoopOrder( shape, stridesX, stridesY, stridesZ, stridesW );
9494
// returns {...}
9595
```
9696

9797
The function returns an object having the following properties:
9898

9999
- **sh**: ordered dimensions.
100-
- **sw**: first input array strides sorted in loop order.
101-
- **sx**: second input array strides sorted in loop order.
102-
- **sy**: third input array strides sorted in loop order.
103-
- **sz**: output array strides sorted in loop order.
100+
- **sx**: first input array strides sorted in loop order.
101+
- **sy**: second input array strides sorted in loop order.
102+
- **sz**: third input array strides sorted in loop order.
103+
- **sw**: output array strides sorted in loop order.
104104

105105
For all returned arrays, the first element corresponds to the innermost loop, and the last element corresponds to the outermost loop.
106106

@@ -143,13 +143,13 @@ var getStrides = require( '@stdlib/ndarray-strides' );
143143
var ternaryLoopOrder = require( '@stdlib/ndarray-base-binary-loop-interchange-order' );
144144

145145
// Create ndarrays:
146-
var w = array( [ [ 1, 2 ], [ 3, 4 ] ] );
147-
var x = array( [ [ 5, 6 ], [ 7, 8 ] ] );
148-
var y = array( [ [ 9, 10 ], [ 11, 12 ] ] );
149-
var z = array( [ [ 0, 0 ], [ 0, 0 ] ] );
146+
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
147+
var y = array( [ [ 5, 6 ], [ 7, 8 ] ] );
148+
var z = array( [ [ 9, 10 ], [ 11, 12 ] ] );
149+
var w = array( [ [ 0, 0 ], [ 0, 0 ] ] );
150150

151151
// Resolve loop interchange data:
152-
var o = ternaryLoopOrder( getShape( w ), getStrides( w ), getStrides( x ), getStrides( y ), getStrides( z ) );
152+
var o = ternaryLoopOrder( getShape( x ), getStrides( x ), getStrides( y ), getStrides( z ), getStrides( w ) );
153153
// returns {...}
154154

155155
console.log( o );

benchmark/benchmark.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
var bench = require( '@stdlib/bench-harness' );
2424
var isArray = require( '@stdlib/assert-is-array' );
2525
var shape2strides = require( '@stdlib/ndarray-base-shape2strides' );
26+
var format = require( '@stdlib/string-format' );
2627
var pkg = require( './../package.json' ).name;
2728
var ternaryLoopOrder = require( './../lib' );
2829

2930

3031
// MAIN //
3132

32-
bench( pkg+'::row-major', function benchmark( b ) {
33+
bench( format( '%s::row-major', pkg ), function benchmark( b ) {
3334
var strides;
3435
var factors;
3536
var shape;
@@ -52,14 +53,20 @@ bench( pkg+'::row-major', function benchmark( b ) {
5253
}
5354
}
5455
b.toc();
55-
if ( !isArray( out.sh ) || !isArray( out.sx ) || !isArray( out.sy ) || !isArray( out.sz ) ) { // eslint-disable-line max-len
56+
if (
57+
!isArray( out.sh ) ||
58+
!isArray( out.sx ) ||
59+
!isArray( out.sy ) ||
60+
!isArray( out.sz ) ||
61+
!isArray( out.sw )
62+
) {
5663
b.fail( 'should return an array' );
5764
}
5865
b.pass( 'benchmark finished' );
5966
b.end();
6067
});
6168

62-
bench( pkg+'::column-major', function benchmark( b ) {
69+
bench( format( '%s::column-major', pkg ), function benchmark( b ) {
6370
var strides;
6471
var factors;
6572
var shape;
@@ -82,7 +89,13 @@ bench( pkg+'::column-major', function benchmark( b ) {
8289
}
8390
}
8491
b.toc();
85-
if ( !isArray( out.sh ) || !isArray( out.sx ) || !isArray( out.sy ) || !isArray( out.sz ) ) { // eslint-disable-line max-len
92+
if (
93+
!isArray( out.sh ) ||
94+
!isArray( out.sx ) ||
95+
!isArray( out.sy ) ||
96+
!isArray( out.sz ) ||
97+
!isArray( out.sw )
98+
) {
8699
b.fail( 'should return an array' );
87100
}
88101
b.pass( 'benchmark finished' );

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/repl.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

2-
{{alias}}( shape, stridesW, stridesX, stridesY, stridesZ )
2+
{{alias}}( shape, stridesX, stridesY, stridesZ, stridesW )
33
Reorders ndarray dimensions and associated strides for loop interchange.
44

55
The function returns an object having the following properties:
66

77
- sh: ordered dimensions.
8-
- sw: first input array strides sorted in loop order.
9-
- sx: second input array strides sorted in loop order.
10-
- sy: third input array strides sorted in loop order.
11-
- sz: output array strides sorted in loop order.
8+
- sx: first input array strides sorted in loop order.
9+
- sy: second input array strides sorted in loop order.
10+
- sz: third input array strides sorted in loop order.
11+
- sw: output array strides sorted in loop order.
1212

1313
For all returned arrays, the first element corresponds to the innermost
1414
loop, and the last element corresponds to the outermost loop.
@@ -21,16 +21,16 @@
2121
shape: ArrayLikeObject<integer>
2222
Array dimensions.
2323

24-
stridesW: ArrayLikeObject<integer>
24+
stridesX: ArrayLikeObject<integer>
2525
First input array strides.
2626

27-
stridesX: ArrayLikeObject<integer>
27+
stridesY: ArrayLikeObject<integer>
2828
Second input array strides.
2929

30-
stridesY: ArrayLikeObject<integer>
30+
stridesZ: ArrayLikeObject<integer>
3131
Third input array strides.
3232

33-
stridesZ: ArrayLikeObject<integer>
33+
stridesW: ArrayLikeObject<integer>
3434
Output array strides.
3535

3636
Returns
@@ -41,25 +41,30 @@
4141
out.sh: Array<integer>
4242
Ordered dimensions.
4343

44-
out.sw: Array<integer>
44+
out.sx: Array<integer>
4545
First input array strides sorted in loop order.
4646

47-
out.sx: Array<integer>
47+
out.sy: Array<integer>
4848
Second input array strides sorted in loop order.
4949

50-
out.sy: Array<integer>
50+
out.sz: Array<integer>
5151
Third input array strides sorted in loop order.
5252

53-
out.sz: Array<integer>
53+
out.sw: Array<integer>
5454
Output array strides sorted in loop order.
5555

5656
Examples
5757
--------
58-
> var w = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] );
59-
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 5, 6 ], [ 7, 8 ] ] );
60-
> var y = {{alias:@stdlib/ndarray/array}}( [ [ 9, 10 ], [ 11, 12 ] ] );
61-
> var z = {{alias:@stdlib/ndarray/array}}( [ [ 0, 0 ], [ 0, 0 ] ] );
62-
> var o = {{alias}}( w.shape, w.strides, x.strides, y.strides, z.strides )
58+
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] );
59+
> var y = {{alias:@stdlib/ndarray/array}}( [ [ 5, 6 ], [ 7, 8 ] ] );
60+
> var z = {{alias:@stdlib/ndarray/array}}( [ [ 9, 10 ], [ 11, 12 ] ] );
61+
> var w = {{alias:@stdlib/ndarray/array}}( [ [ 0, 0 ], [ 0, 0 ] ] );
62+
> var sh = {{alias:@stdlib/ndarray/shape}}( x );
63+
> var sx = {{alias:@stdlib/ndarray/strides}}( x );
64+
> var sy = {{alias:@stdlib/ndarray/strides}}( y );
65+
> var sz = {{alias:@stdlib/ndarray/strides}}( z );
66+
> var sw = {{alias:@stdlib/ndarray/strides}}( w );
67+
> var o = {{alias}}( sh, sx, sy, sz, sw )
6368
{...}
6469

6570
See Also

0 commit comments

Comments
 (0)