You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays...
261
-
if(ns===ndims-1){
262
-
// Get the index of the non-singleton dimension...
263
-
for(i=0;i<ndims;i++){
264
-
if(shx[i]!==1){
265
-
break;
266
-
}
267
-
}
268
-
x.shape=[shx[i]];
269
-
y.shape=x.shape;
270
-
x.strides=[sx[i]];
271
-
y.strides=[sy[i]];
272
-
if(x.accessorProtocol||y.accessorProtocol){
273
-
returnACCESSOR_MAP[1](x,y,fcn,thisArg);
274
-
}
275
-
returnMAP[1](x,y,fcn,thisArg);
276
-
}
277
-
278
-
iox=iterationOrder(sx);// +/-1
279
-
ioy=iterationOrder(sy);// +/-1
242
+
// Determine iteration order:
243
+
iox=iterationOrder(x.strides);// +/-1
244
+
ioy=iterationOrder(y.strides);// +/-1
280
245
281
246
// Determine whether we can avoid blocked iteration...
282
247
if(iox!==0&&ioy!==0&&iox===ioy){
283
-
// Determine the minimum and maximum linear indices which are accessible by the array views:
284
-
xmmv=minmaxViewBufferIndex(shx,sx,x.offset);
285
-
ymmv=minmaxViewBufferIndex(shy,sy,y.offset);
286
-
287
-
// Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays...
// Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values...
290
-
if(iox===1){
291
-
ox=xmmv[0];
292
-
}else{
293
-
ox=xmmv[1];
294
-
}
295
-
if(ioy===1){
296
-
oy=ymmv[0];
297
-
}else{
298
-
oy=ymmv[1];
299
-
}
300
-
x.shape=[len];
301
-
y.shape=x.shape;
302
-
x.strides=[iox];
303
-
y.strides=[ioy];
304
-
x.offset=ox;
305
-
y.offset=oy;
306
-
if(x.accessorProtocol||y.accessorProtocol){
307
-
returnACCESSOR_MAP[1](x,y,fcn,thisArg);
308
-
}
309
-
returnMAP[1](x,y,fcn,thisArg);
310
-
}
311
-
// At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...
312
-
313
248
// Determine whether we can use simple nested loops...
314
249
if(ndims<=MAX_DIMS){
315
250
// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...
// At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration...
324
-
325
258
// Determine whether we can perform blocked iteration...
0 commit comments