Skip to content

Commit c1b23bb

Browse files
committed
Auto-generated commit
1 parent a7d98b2 commit c1b23bb

File tree

8 files changed

+35
-18
lines changed

8 files changed

+35
-18
lines changed

CHANGELOG.md

Lines changed: 3 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-05-07)
7+
## Unreleased (2025-05-12)
88

99
<section class="features">
1010

@@ -22,6 +22,8 @@
2222

2323
<details>
2424

25+
- [`603ba97`](https://github.com/stdlib-js/stdlib/commit/603ba974c88f33cb73ba53c69435183ca535ded9) - **docs:** fix parameter names _(by Athan Reines)_
26+
- [`d8fe0d8`](https://github.com/stdlib-js/stdlib/commit/d8fe0d87591079990591bd5727abdabaa81cd265) - **bench:** update value generation and update examples _(by Athan Reines)_
2527
- [`3dd8cb3`](https://github.com/stdlib-js/stdlib/commit/3dd8cb379ea22c4a92d610d146cdd662d3187e27) - **chore:** minor clean-up _(by Philipp Burckhardt)_
2628
- [`0d360b3`](https://github.com/stdlib-js/stdlib/commit/0d360b33eba8019d2d638f265986d861ed22642a) - **feat:** return index array as part of the results object _(by Athan Reines)_
2729

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Utkarsh <http://utkarsh11105@gmail.com>
174174
Utkarsh Raj <rajutkarsh2505@gmail.com>
175175
UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
176176
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
177+
Vara Rahul Rajana <123227543+rajanarahul93@users.noreply.github.com>
177178
Varad Gupta <varadgupta21@gmail.com>
178179
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
179180
Vivek Maurya <vm8118134@gmail.com>

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ For all returned arrays, the first element corresponds to the innermost loop, an
133133

134134
```javascript
135135
var array = require( '@stdlib/ndarray-array' );
136-
var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );
136+
var getShape = require( '@stdlib/ndarray-shape' );
137+
var getStrides = require( '@stdlib/ndarray-strides' );
138+
var unaryLoopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );
137139

138140
// Create ndarrays:
139141
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
140142
var y = array( [ [ 0, 0 ], [ 0, 0 ] ] );
141143

142144
// Resolve loop interchange data:
143-
var o = loopOrder( x.shape, x.strides, y.strides );
145+
var o = unaryLoopOrder( getShape( x ), getStrides( x ), getStrides( y ) );
144146
// returns {...}
145147

146148
console.log( o );

benchmark/benchmark.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
2524
var isArray = require( '@stdlib/assert-is-array' );
2625
var shape2strides = require( '@stdlib/ndarray-base-shape2strides' );
2726
var pkg = require( './../package.json' ).name;
@@ -32,16 +31,21 @@ var loopOrder = require( './../lib' );
3231

3332
bench( pkg+'::row-major', function benchmark( b ) {
3433
var strides;
34+
var factors;
3535
var shape;
3636
var out;
3737
var i;
3838

3939
shape = [ 10, 10, 10 ];
4040
strides = shape2strides( shape, 'row-major' );
41+
factors = [
42+
-1,
43+
1
44+
];
4145

4246
b.tic();
4347
for ( i = 0; i < b.iterations; i++ ) {
44-
strides[ i%shape.length ] *= ( randu() < 0.5 ) ? -1 : 1;
48+
strides[ i%shape.length ] *= factors[ i%factors.length ];
4549
out = loopOrder( shape, strides, strides );
4650
if ( typeof out !== 'object' ) {
4751
b.fail( 'should return an object' );
@@ -57,16 +61,21 @@ bench( pkg+'::row-major', function benchmark( b ) {
5761

5862
bench( pkg+'::column-major', function benchmark( b ) {
5963
var strides;
64+
var factors;
6065
var shape;
6166
var out;
6267
var i;
6368

6469
shape = [ 10, 10, 10 ];
6570
strides = shape2strides( shape, 'column-major' );
71+
factors = [
72+
-1,
73+
1
74+
];
6675

6776
b.tic();
6877
for ( i = 0; i < b.iterations; i++ ) {
69-
strides[ i%shape.length ] *= ( randu() < 0.5 ) ? -1 : 1;
78+
strides[ i%shape.length ] *= factors[ i%factors.length ];
7079
out = loopOrder( shape, strides, strides );
7180
if ( typeof out !== 'object' ) {
7281
b.fail( 'should return an object' );

docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ interface LoopOrderObject {
6767
*
6868
* - The function assumes that the input and output ndarrays have the same shape. Hence, loop interchange order should only be determined **after** broadcasting.
6969
*
70-
* @param sh - array dimensions
71-
* @param sx - input array stride lengths
72-
* @param sy - output array stride lengths
70+
* @param shape - array dimensions
71+
* @param stridesX - input array stride lengths
72+
* @param stridesY - output array stride lengths
7373
* @returns loop interchange data
7474
*
7575
* @example

examples/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
'use strict';
2020

2121
var array = require( '@stdlib/ndarray-array' );
22-
var loopOrder = require( './../lib' );
22+
var getShape = require( '@stdlib/ndarray-shape' );
23+
var getStrides = require( '@stdlib/ndarray-strides' );
24+
var unaryLoopOrder = require( './../lib' );
2325

2426
// Create ndarrays:
2527
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
2628
var y = array( [ [ 0, 0 ], [ 0, 0 ] ] );
2729

2830
// Resolve loop interchange data:
29-
var o = loopOrder( x.shape, x.strides, y.strides );
31+
var o = unaryLoopOrder( getShape( x ), getStrides( x ), getStrides( y ) );
3032
// returns {...}
3133

3234
console.log( o );

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"@stdlib/assert-is-array": "^0.2.2",
4747
"@stdlib/ndarray-array": "^0.2.1",
4848
"@stdlib/ndarray-base-shape2strides": "^0.2.2",
49-
"@stdlib/random-base-randu": "^0.2.1",
49+
"@stdlib/ndarray-shape": "^0.2.2",
50+
"@stdlib/ndarray-strides": "^0.2.2",
5051
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5152
"istanbul": "^0.4.1",
5253
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",

test/test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
var tape = require( 'tape' );
2424
var isArray = require( '@stdlib/assert-is-array' );
25-
var loopOrder = require( './../lib' );
25+
var unaryLoopOrder = require( './../lib' );
2626

2727

2828
// TESTS //
2929

3030
tape( 'main export is a function', function test( t ) {
3131
t.ok( true, __filename );
32-
t.strictEqual( typeof loopOrder, 'function', 'main export is a function' );
32+
t.strictEqual( typeof unaryLoopOrder, 'function', 'main export is a function' );
3333
t.end();
3434
});
3535

@@ -43,7 +43,7 @@ tape( 'the function returns loop interchange data (row-major)', function test( t
4343
sx = [ 4, -2, 1 ];
4444
sy = [ -4, 2, 1 ];
4545

46-
o = loopOrder( sh, sx, sy );
46+
o = unaryLoopOrder( sh, sx, sy );
4747

4848
t.notEqual( o.sh, sh, 'returns new array' );
4949
t.strictEqual( isArray( o.sh ), true, 'returns expected value' );
@@ -73,7 +73,7 @@ tape( 'the function returns loop interchange data (column-major)', function test
7373
sx = [ 1, -4, 8 ];
7474
sy = [ -1, 4, 8 ];
7575

76-
o = loopOrder( sh, sx, sy );
76+
o = unaryLoopOrder( sh, sx, sy );
7777

7878
t.notEqual( o.sh, sh, 'returns new array' );
7979
t.strictEqual( isArray( o.sh ), true, 'returns expected value' );
@@ -103,7 +103,7 @@ tape( 'the function returns loop interchange data (mixed order)', function test(
103103
sx = [ 4, -2, 1 ];
104104
sy = [ 1, -4, -8 ];
105105

106-
o = loopOrder( sh, sx, sy );
106+
o = unaryLoopOrder( sh, sx, sy );
107107

108108
t.notEqual( o.sh, sh, 'returns new array' );
109109
t.strictEqual( isArray( o.sh ), true, 'returns expected value' );
@@ -124,7 +124,7 @@ tape( 'the function returns loop interchange data (mixed order)', function test(
124124
});
125125

126126
tape( 'if provided empty arrays, the function returns empty arrays', function test( t ) {
127-
var o = loopOrder( [], [], [] );
127+
var o = unaryLoopOrder( [], [], [] );
128128
t.deepEqual( o.sh, [], 'returns expected value' );
129129
t.deepEqual( o.sx, [], 'returns expected value' );
130130
t.deepEqual( o.sy, [], 'returns expected value' );

0 commit comments

Comments
 (0)