Skip to content

Commit 98eb0b6

Browse files
committed
Auto-generated commit
1 parent 6413f05 commit 98eb0b6

26 files changed

Lines changed: 158 additions & 158 deletions

CHANGELOG.md

Lines changed: 9 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-08)
88

99
<section class="features">
1010

@@ -251,6 +251,8 @@
251251

252252
### Bug Fixes
253253

254+
- [`18036a4`](https://github.com/stdlib-js/stdlib/commit/18036a4b73cbae2f90f5ce929645d1eb769138dc) - use resolved order when determining increment offsets
255+
- [`3ce09af`](https://github.com/stdlib-js/stdlib/commit/3ce09af9819ae7dbaad178179264fc84c5db5690) - ensure separate array instance for each memory layout
254256
- [`7c29c2d`](https://github.com/stdlib-js/stdlib/commit/7c29c2d3aea7b8d0396a77f6781d7d76bd7adde4) - use computed order
255257
- [`8722299`](https://github.com/stdlib-js/stdlib/commit/8722299df603836eaf1aba2404e833f77db4ed0b) - use computed order
256258
- [`e0a04fe`](https://github.com/stdlib-js/stdlib/commit/e0a04fe3cbdcab5adb4529158d2ccf085fb971a6) - use computed order
@@ -350,7 +352,13 @@ A total of 14 issues were closed in this release:
350352

351353
<details>
352354

355+
- [`18036a4`](https://github.com/stdlib-js/stdlib/commit/18036a4b73cbae2f90f5ce929645d1eb769138dc) - **fix:** use resolved order when determining increment offsets _(by Athan Reines)_
356+
- [`ac7d5b4`](https://github.com/stdlib-js/stdlib/commit/ac7d5b41eeefdc2a27ffeb244442c2e29feb728c) - **refactor:** use assertion utility rather than hardcoded string _(by Athan Reines)_
357+
- [`2464b78`](https://github.com/stdlib-js/stdlib/commit/2464b78c6e164fd048d04d13d57a3ba44707cac9) - **docs:** remove import _(by Athan Reines)_
358+
- [`3ce09af`](https://github.com/stdlib-js/stdlib/commit/3ce09af9819ae7dbaad178179264fc84c5db5690) - **fix:** ensure separate array instance for each memory layout _(by Athan Reines)_
359+
- [`974d32e`](https://github.com/stdlib-js/stdlib/commit/974d32e3dcd93a5d44360e185a8c66ebbc3e5076) - **refactor:** use base array utility _(by Athan Reines)_
353360
- [`3dd8cb3`](https://github.com/stdlib-js/stdlib/commit/3dd8cb379ea22c4a92d610d146cdd662d3187e27) - **chore:** minor clean-up _(by Philipp Burckhardt)_
361+
- [`2e62223`](https://github.com/stdlib-js/stdlib/commit/2e6222321d2f7e50afa459c0dc815c56ec83fdf5) - **chore:** remove directory until we have actually added benchmarks _(by Athan Reines)_
354362
- [`b403898`](https://github.com/stdlib-js/stdlib/commit/b403898016bc31f1331765bb5bfbcab94f0e1692) - **test:** add initial tests _(by Athan Reines)_
355363
- [`590a7d9`](https://github.com/stdlib-js/stdlib/commit/590a7d9fc1e57249015e425c59201fc9e5daeb0c) - **docs:** add REPL help and TypeScript declarations _(by Athan Reines)_
356364
- [`903ffa2`](https://github.com/stdlib-js/stdlib/commit/903ffa2ffea01672dd401cfe3c210a525c484590) - **docs:** add example _(by Athan Reines)_

base/binary-loop-interchange-order/lib/main.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
var zeroTo = require( '@stdlib/array/base/zero-to' );
2424
var copy = require( '@stdlib/array/base/copy-indexed' );
2525
var take = require( '@stdlib/array/base/take-indexed' );
26-
var filled = require( '@stdlib/array/base/filled' );
2726
var strides2order = require( './../../../base/strides2order' );
2827
var sort2ins = require( './sort2ins.js' );
2928

@@ -97,7 +96,7 @@ function loopOrder( sh, sx, sy, sz ) {
9796
oz = strides2order( sz );
9897

9998
// Determine which array should be used to generate the loop order:
100-
tmp = filled( [], 4 );
99+
tmp = [ [], [], [], [] ];
101100
tmp[ ox ].push( sx );
102101
tmp[ oy ].push( sy );
103102
tmp[ oz ].push( sz );
@@ -132,9 +131,9 @@ function loopOrder( sh, sx, sy, sz ) {
132131

133132
// Permute the shape and array strides based on the sorted strides:
134133
sh = take( sh, idx );
135-
sx = ( sx === arr ) ? arr : take( sx, idx );
136-
sy = ( sy === arr ) ? arr : take( sy, idx );
137-
sz = ( sz === arr ) ? arr : take( sz, idx );
134+
sx = take( sx, idx );
135+
sy = take( sy, idx );
136+
sz = take( sz, idx );
138137

139138
return {
140139
'sh': sh,

base/binary-loop-interchange-order/lib/sort2ins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* - The first array is sorted in increasing order according to absolute value.
2929
* - The algorithm has space complexity `O(1)` and worst case time complexity `O(N^2)`.
30-
* - The algorithm is efficient for small arrays (typically `N <= 20``) and is particularly efficient for sorting arrays which are already substantially sorted.
30+
* - The algorithm is efficient for small arrays (typically `N <= 20`) and is particularly efficient for sorting arrays which are already substantially sorted.
3131
* - The algorithm is **stable**, meaning that the algorithm does **not** change the order of array elements which are equal or equivalent.
3232
* - The input arrays are sorted in-place (i.e., the input arrays are mutated).
3333
*

base/binary-loop-interchange-order/test/test.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,72 @@ tape( 'the function returns loop interchange data (mixed order)', function test(
132132
t.end();
133133
});
134134

135+
tape( 'the function returns loop interchange data (mostly disorganized)', function test( t ) {
136+
var sh;
137+
var sx;
138+
var sy;
139+
var sz;
140+
var o;
141+
142+
sh = [ 4, 2, 2 ];
143+
sx = [ -2, 4, 1 ]; // disorganized
144+
sy = [ -4, 2, 1 ]; // row-major
145+
sz = [ -8, -2, 4 ]; // disorganized
146+
147+
o = loopOrder( sh, sx, sy, sz );
148+
149+
t.notEqual( o.sh, sh, 'returns new array' );
150+
t.strictEqual( isArray( o.sh ), true, 'returns expected value' );
151+
t.deepEqual( o.sh, [ 2, 2, 4 ], 'returns expected value' );
152+
153+
t.notEqual( o.sx, sx, 'returns new array' );
154+
t.strictEqual( isArray( o.sx ), true, 'returns expected value' );
155+
t.deepEqual( o.sx, [ 1, 4, -2 ], 'returns expected value' );
156+
157+
t.notEqual( o.sy, sy, 'returns new array' );
158+
t.strictEqual( isArray( o.sy ), true, 'returns expected value' );
159+
t.deepEqual( o.sy, [ 1, 2, -4 ], 'returns expected value' );
160+
161+
t.notEqual( o.sz, sz, 'returns new array' );
162+
t.strictEqual( isArray( o.sz ), true, 'returns expected value' );
163+
t.deepEqual( o.sz, [ 4, -2, -8 ], 'returns expected value' );
164+
165+
t.end();
166+
});
167+
168+
tape( 'the function returns loop interchange data (all disorganized)', function test( t ) {
169+
var sh;
170+
var sx;
171+
var sy;
172+
var sz;
173+
var o;
174+
175+
sh = [ 4, 2, 2 ];
176+
sx = [ -2, 4, 1 ]; // disorganized
177+
sy = [ 1, -4, 2 ]; // disorganized
178+
sz = [ -8, -2, 4 ]; // disorganized
179+
180+
o = loopOrder( sh, sx, sy, sz );
181+
182+
t.notEqual( o.sh, sh, 'returns new array' );
183+
t.strictEqual( isArray( o.sh ), true, 'returns expected value' );
184+
t.deepEqual( o.sh, [ 2, 4, 2 ], 'returns expected value' );
185+
186+
t.notEqual( o.sx, sx, 'returns new array' );
187+
t.strictEqual( isArray( o.sx ), true, 'returns expected value' );
188+
t.deepEqual( o.sx, [ 1, -2, 4 ], 'returns expected value' );
189+
190+
t.notEqual( o.sy, sy, 'returns new array' );
191+
t.strictEqual( isArray( o.sy ), true, 'returns expected value' );
192+
t.deepEqual( o.sy, [ 2, 1, -4 ], 'returns expected value' );
193+
194+
t.notEqual( o.sz, sz, 'returns new array' );
195+
t.strictEqual( isArray( o.sz ), true, 'returns expected value' );
196+
t.deepEqual( o.sz, [ 4, -8, -2 ], 'returns expected value' );
197+
198+
t.end();
199+
});
200+
135201
tape( 'if provided empty arrays, the function returns empty arrays', function test( t ) {
136202
var o = loopOrder( [], [], [], [] );
137203
t.deepEqual( o.sh, [], 'returns expected value' );

base/binary/lib/10d.js

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

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var isRowMajor = require( './../../../base/assert/is-row-major-string' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -52,6 +47,7 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
5247
* @param {IntegerArray} z.strides - stride lengths
5348
* @param {NonNegativeInteger} z.offset - index offset
5449
* @param {string} z.order - specifies whether `z` is row-major (C-style) or column-major (Fortran-style)
50+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5551
* @param {Callback} fcn - binary callback
5652
* @returns {void}
5753
*
@@ -107,12 +103,12 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
107103
* };
108104
*
109105
* // Apply the binary function:
110-
* binary10d( x, y, z, fcn );
106+
* binary10d( x, y, z, true, fcn );
111107
*
112108
* console.log( z.data );
113109
* // => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 ]
114110
*/
115-
function binary10d( x, y, z, fcn ) {
111+
function binary10d( x, y, z, isRowMajor, fcn ) {
116112
var xbuf;
117113
var ybuf;
118114
var zbuf;
@@ -181,7 +177,7 @@ function binary10d( x, y, z, fcn ) {
181177
sx = x.strides;
182178
sy = y.strides;
183179
sz = z.strides;
184-
if ( isRowMajor( x.order ) ) {
180+
if ( isRowMajor ) {
185181
// For row-major ndarrays, the last dimensions have the fastest changing indices...
186182
S0 = sh[ 9 ];
187183
S1 = sh[ 8 ];

base/binary/lib/10d_accessors.js

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

2121
'use strict';
2222

23-
// MODULES //
24-
25-
var isRowMajor = require( './../../../base/assert/is-row-major-string' );
26-
27-
2823
// MAIN //
2924

3025
/**
@@ -55,6 +50,7 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
5550
* @param {NonNegativeInteger} z.offset - index offset
5651
* @param {string} z.order - specifies whether `z` is row-major (C-style) or column-major (Fortran-style)
5752
* @param {Array<Function>} z.accessors - data buffer accessors
53+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5854
* @param {Callback} fcn - binary callback
5955
* @returns {void}
6056
*
@@ -115,12 +111,12 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
115111
* };
116112
*
117113
* // Apply the binary function:
118-
* binary10d( x, y, z, fcn );
114+
* binary10d( x, y, z, true, fcn );
119115
*
120116
* console.log( copy( z.data ) );
121117
* // => [ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 ]
122118
*/
123-
function binary10d( x, y, z, fcn ) {
119+
function binary10d( x, y, z, isRowMajor, fcn ) {
124120
var xbuf;
125121
var ybuf;
126122
var zbuf;
@@ -192,7 +188,7 @@ function binary10d( x, y, z, fcn ) {
192188
sx = x.strides;
193189
sy = y.strides;
194190
sz = z.strides;
195-
if ( isRowMajor( x.order ) ) {
191+
if ( isRowMajor ) {
196192
// For row-major ndarrays, the last dimensions have the fastest changing indices...
197193
S0 = sh[ 9 ];
198194
S1 = sh[ 8 ];

base/binary/lib/2d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var isRowMajor = require( './../../../base/assert/is-row-major-string' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -50,6 +45,7 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
5045
* @param {IntegerArray} z.strides - stride lengths
5146
* @param {NonNegativeInteger} z.offset - index offset
5247
* @param {string} z.order - specifies whether `z` is row-major (C-style) or column-major (Fortran-style)
48+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5349
* @param {Callback} fcn - binary callback
5450
* @returns {void}
5551
*
@@ -105,12 +101,12 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
105101
* };
106102
*
107103
* // Apply the binary function:
108-
* binary2d( x, y, z, fcn );
104+
* binary2d( x, y, z, true, fcn );
109105
*
110106
* console.log( z.data );
111107
* // => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 ]
112108
*/
113-
function binary2d( x, y, z, fcn ) {
109+
function binary2d( x, y, z, isRowMajor, fcn ) {
114110
var xbuf;
115111
var ybuf;
116112
var zbuf;
@@ -139,7 +135,7 @@ function binary2d( x, y, z, fcn ) {
139135
sx = x.strides;
140136
sy = y.strides;
141137
sz = z.strides;
142-
if ( isRowMajor( x.order ) ) {
138+
if ( isRowMajor ) {
143139
// For row-major ndarrays, the last dimensions have the fastest changing indices...
144140
S0 = sh[ 1 ];
145141
S1 = sh[ 0 ];

base/binary/lib/2d_accessors.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var isRowMajor = require( './../../../base/assert/is-row-major-string' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -53,6 +48,7 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
5348
* @param {NonNegativeInteger} z.offset - index offset
5449
* @param {string} z.order - specifies whether `z` is row-major (C-style) or column-major (Fortran-style)
5550
* @param {Array<Function>} z.accessors - data buffer accessors
51+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5652
* @param {Callback} fcn - binary callback
5753
* @returns {void}
5854
*
@@ -113,12 +109,12 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
113109
* };
114110
*
115111
* // Apply the binary function:
116-
* binary2d( x, y, z, fcn );
112+
* binary2d( x, y, z, true, fcn );
117113
*
118114
* console.log( copy( z.data ) );
119115
* // => [ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 ]
120116
*/
121-
function binary2d( x, y, z, fcn ) {
117+
function binary2d( x, y, z, isRowMajor, fcn ) {
122118
var xbuf;
123119
var ybuf;
124120
var zbuf;
@@ -150,7 +146,7 @@ function binary2d( x, y, z, fcn ) {
150146
sx = x.strides;
151147
sy = y.strides;
152148
sz = z.strides;
153-
if ( isRowMajor( x.order ) ) {
149+
if ( isRowMajor ) {
154150
// For row-major ndarrays, the last dimensions have the fastest changing indices...
155151
S0 = sh[ 1 ];
156152
S1 = sh[ 0 ];

base/binary/lib/3d.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
'use strict';
2020

21-
// MODULES //
22-
23-
var isRowMajor = require( './../../../base/assert/is-row-major-string' );
24-
25-
2621
// MAIN //
2722

2823
/**
@@ -50,6 +45,7 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
5045
* @param {IntegerArray} z.strides - stride lengths
5146
* @param {NonNegativeInteger} z.offset - index offset
5247
* @param {string} z.order - specifies whether `z` is row-major (C-style) or column-major (Fortran-style)
48+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
5349
* @param {Callback} fcn - binary callback
5450
* @returns {void}
5551
*
@@ -105,12 +101,12 @@ var isRowMajor = require( './../../../base/assert/is-row-major-string' );
105101
* };
106102
*
107103
* // Apply the binary function:
108-
* binary3d( x, y, z, fcn );
104+
* binary3d( x, y, z, true, fcn );
109105
*
110106
* console.log( z.data );
111107
* // => <Float64Array>[ 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0 ]
112108
*/
113-
function binary3d( x, y, z, fcn ) {
109+
function binary3d( x, y, z, isRowMajor, fcn ) {
114110
var xbuf;
115111
var ybuf;
116112
var zbuf;
@@ -144,7 +140,7 @@ function binary3d( x, y, z, fcn ) {
144140
sx = x.strides;
145141
sy = y.strides;
146142
sz = z.strides;
147-
if ( isRowMajor( x.order ) ) {
143+
if ( isRowMajor ) {
148144
// For row-major ndarrays, the last dimensions have the fastest changing indices...
149145
S0 = sh[ 2 ];
150146
S1 = sh[ 1 ];

0 commit comments

Comments
 (0)