Skip to content

Commit c57d1d8

Browse files
committed
fix: return subscripts from perspective of ndarray view, not buffer
1 parent ba0f3a0 commit c57d1d8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/node_modules/@stdlib/ndarray/base/for-each/lib/nd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function forEachnd( x, fcn, thisArg ) {
110110
// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...
111111
for ( i = 0; i < len; i++ ) {
112112
ix = vind2bind( sh, sx, ox, ordx, i, MODE );
113-
idx = ind2sub( sh, sx, ox, ordx, i, MODE );
113+
idx = ind2sub( sh, sx, 0, ordx, i, MODE ); // return subscripts from the perspective of the ndarray view
114114
fcn.call( thisArg, xbuf[ ix ], idx, x.ref );
115115
}
116116
}

lib/node_modules/@stdlib/ndarray/base/for-each/lib/nd_accessors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function forEachnd( x, fcn, thisArg ) {
128128
// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...
129129
for ( i = 0; i < len; i++ ) {
130130
ix = vind2bind( sh, sx, ox, ordx, i, MODE );
131-
idx = ind2sub( sh, sx, ox, ordx, i, MODE );
131+
idx = ind2sub( sh, sx, 0, ordx, i, MODE ); // return subscripts from the perspective of the ndarray view
132132
fcn.call( thisArg, get( xbuf, ix ), idx, x.ref );
133133
}
134134
}

0 commit comments

Comments
 (0)