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 an ndarray as being equivalent to a one-dimensional strided array...
232
-
if(ns===ndims-1){
233
-
// Get the index of the non-singleton dimension...
234
-
for(i=0;i<ndims;i++){
235
-
if(shx[i]!==1){
236
-
break;
237
-
}
238
-
}
239
-
x.shape=[shx[i]];
240
-
x.strides=[sx[i]];
241
-
if(x.accessorProtocol){
242
-
returnACCESSOR_EVERY[1](x,clbk,thisArg);
243
-
}
244
-
returnEVERY[1](x,clbk,thisArg);
245
-
}
246
-
iox=iterationOrder(sx);// +/-1
211
+
// Determine the iteration order:
212
+
iox=iterationOrder(x.strides);// +/-1
247
213
248
214
// Determine whether we can avoid blocked iteration...
249
215
if(iox!==0){
250
-
// Determine the minimum and maximum linear indices which are accessible by the array view:
251
-
xmmv=minmaxViewBufferIndex(shx,sx,x.offset);
252
-
253
-
// Determine whether we can ignore shape (and strides) and treat the ndarray as a linear one-dimensional strided array...
// Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values...
256
-
if(iox===1){
257
-
ox=xmmv[0];
258
-
}else{
259
-
ox=xmmv[1];
260
-
}
261
-
x.shape=[len];
262
-
x.strides=[(isCmplx) ? iox*2 : iox];
263
-
x.offset=ox;
264
-
if(x.accessorProtocol){
265
-
returnACCESSOR_EVERY[1](x,clbk,thisArg);
266
-
}
267
-
returnEVERY[1](x,clbk,thisArg);
268
-
}
269
-
// The ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...
270
-
271
216
// Determine whether we can use simple nested loops...
272
217
if(ndims<=MAX_DIMS){
273
218
// So long as iteration 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 a non-contiguous n-dimensional array or a high dimensional n-dimensional array, so our only hope is that we can still perform blocked iteration...
282
-
283
226
// Determine whether we can perform blocked iteration...
0 commit comments