Skip to content

Commit cec872e

Browse files
committed
perf: use ternary loopOrder instead of unary
1 parent e3729ee commit cec872e

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

lib/node_modules/@stdlib/ndarray/base/where/lib/2d_blocked.js

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

2121
// MODULES //
2222

23-
var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' );
23+
var loopOrder = require( '@stdlib/ndarray/base/ternary-loop-interchange-order' );
2424
var blockSize = require( '@stdlib/ndarray/base/ternary-tiling-block-size' );
25-
var take = require( '@stdlib/array/base/take-indexed' );
2625

2726

2827
// MAIN //
@@ -167,15 +166,15 @@ function blockedwhere2d( condition, x, y, out ) {
167166

168167
// Note on variable naming convention: s#, dc#, dx#, dy#, do#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...
169168

170-
// Resolve the loop interchange order using x as the reference array.
171-
o = loopOrder( x.shape, x.strides, out.strides );
172-
sh = o.sh;
173-
sx = o.sx;
174-
so = o.sy;
175-
176-
// Apply the same dimension permutation to condition and y strides so that
177-
sc = take( condition.strides, o.idx );
178-
sy = take( y.strides, o.idx );
169+
// Resolve the loop interchange order:
170+
o = loopOrder( condition.shape, condition.strides, x.strides, y.strides, out.strides );
171+
172+
// Strides output as follows: sx, sy, sz, sw. According to arguments order respectively..
173+
sh = o.sh;
174+
sc = o.sx;
175+
sx = o.sy;
176+
sy = o.sz;
177+
so = o.sw;
179178

180179
// Determine the block size:
181180
bsize = blockSize( condition.dtype, x.dtype, y.dtype, out.dtype );

0 commit comments

Comments
 (0)