Skip to content

Commit e00f861

Browse files
committed
refactor: ensure iteration happens according to memory layout of input ndarray
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 6c629cf commit e00f861

File tree

10 files changed

+38
-36
lines changed

10 files changed

+38
-36
lines changed

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ Each provided ndarray should be an object with the following properties:
150150
- **arrays**: array containing a one-dimensional subarray of the input ndarray, a one-dimensional subarray of the output ndarray, and any additional ndarray arguments as zero-dimensional ndarrays.
151151
- **options**: function options (_optional_).
152152
153+
- The function iterates over ndarray elements according to the memory layout of the input ndarray.
154+
153155
- For very high-dimensional ndarrays which are non-contiguous, one should consider copying the underlying data to contiguous memory before performing a reduction in order to achieve better performance.
154156
155157
</section>

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/10d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ function unary10d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, str
197197
var i7;
198198
var i8;
199199
var i9;
200-
var y;
200+
var x;
201201
var v;
202202
var i;
203203

204204
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
205205

206-
// Resolve the output ndarray:
207-
y = arrays[ 1 ];
206+
// Resolve the input ndarray:
207+
x = arrays[ 0 ];
208208

209209
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
210-
if ( isRowMajor( y.order ) ) {
210+
if ( isRowMajor( x.order ) ) {
211211
// For row-major ndarrays, the last dimensions have the fastest changing indices...
212212
S0 = shape[ 9 ];
213213
S1 = shape[ 8 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/2d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ function unary2d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
171171
var iv;
172172
var i0;
173173
var i1;
174-
var y;
174+
var x;
175175
var v;
176176
var i;
177177

178178
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
179179

180-
// Resolve the output ndarray:
181-
y = arrays[ 1 ];
180+
// Resolve the input ndarray:
181+
x = arrays[ 0 ];
182182

183183
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
184-
if ( isRowMajor( y.order ) ) {
184+
if ( isRowMajor( x.order ) ) {
185185
// For row-major ndarrays, the last dimensions have the fastest changing indices...
186186
S0 = shape[ 1 ];
187187
S1 = shape[ 0 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/3d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,17 @@ function unary3d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
174174
var i0;
175175
var i1;
176176
var i2;
177-
var y;
177+
var x;
178178
var v;
179179
var i;
180180

181181
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
182182

183-
// Resolve the output ndarray:
184-
y = arrays[ 1 ];
183+
// Resolve the input ndarray:
184+
x = arrays[ 0 ];
185185

186186
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
187-
if ( isRowMajor( y.order ) ) {
187+
if ( isRowMajor( x.order ) ) {
188188
// For row-major ndarrays, the last dimensions have the fastest changing indices...
189189
S0 = shape[ 2 ];
190190
S1 = shape[ 1 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/4d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,17 @@ function unary4d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
177177
var i1;
178178
var i2;
179179
var i3;
180-
var y;
180+
var x;
181181
var v;
182182
var i;
183183

184184
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
185185

186-
// Resolve the output ndarray:
187-
y = arrays[ 1 ];
186+
// Resolve the input ndarray:
187+
x = arrays[ 0 ];
188188

189189
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
190-
if ( isRowMajor( y.order ) ) {
190+
if ( isRowMajor( x.order ) ) {
191191
// For row-major ndarrays, the last dimensions have the fastest changing indices...
192192
S0 = shape[ 3 ];
193193
S1 = shape[ 2 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/5d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,17 @@ function unary5d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
180180
var i2;
181181
var i3;
182182
var i4;
183-
var y;
183+
var x;
184184
var v;
185185
var i;
186186

187187
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
188188

189-
// Resolve the output ndarray:
190-
y = arrays[ 1 ];
189+
// Resolve the input ndarray:
190+
x = arrays[ 0 ];
191191

192192
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
193-
if ( isRowMajor( y.order ) ) {
193+
if ( isRowMajor( x.order ) ) {
194194
// For row-major ndarrays, the last dimensions have the fastest changing indices...
195195
S0 = shape[ 4 ];
196196
S1 = shape[ 3 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/6d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,17 @@ function unary6d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
185185
var i3;
186186
var i4;
187187
var i5;
188-
var y;
188+
var x;
189189
var v;
190190
var i;
191191

192192
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
193193

194-
// Resolve the output ndarray:
195-
y = arrays[ 1 ];
194+
// Resolve the input ndarray:
195+
x = arrays[ 0 ];
196196

197197
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
198-
if ( isRowMajor( y.order ) ) {
198+
if ( isRowMajor( x.order ) ) {
199199
// For row-major ndarrays, the last dimensions have the fastest changing indices...
200200
S0 = shape[ 5 ];
201201
S1 = shape[ 4 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/7d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,17 @@ function unary7d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
188188
var i4;
189189
var i5;
190190
var i6;
191-
var y;
191+
var x;
192192
var v;
193193
var i;
194194

195195
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
196196

197-
// Resolve the output ndarray:
198-
y = arrays[ 1 ];
197+
// Resolve the input ndarray:
198+
x = arrays[ 0 ];
199199

200200
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
201-
if ( isRowMajor( y.order ) ) {
201+
if ( isRowMajor( x.order ) ) {
202202
// For row-major ndarrays, the last dimensions have the fastest changing indices...
203203
S0 = shape[ 6 ];
204204
S1 = shape[ 5 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/8d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,17 @@ function unary8d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
191191
var i5;
192192
var i6;
193193
var i7;
194-
var y;
194+
var x;
195195
var v;
196196
var i;
197197

198198
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
199199

200-
// Resolve the output ndarray:
201-
y = arrays[ 1 ];
200+
// Resolve the input ndarray:
201+
x = arrays[ 0 ];
202202

203203
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
204-
if ( isRowMajor( y.order ) ) {
204+
if ( isRowMajor( x.order ) ) {
205205
// For row-major ndarrays, the last dimensions have the fastest changing indices...
206206
S0 = shape[ 7 ];
207207
S1 = shape[ 6 ];

lib/node_modules/@stdlib/ndarray/base/unary-strided1d/lib/9d.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,17 @@ function unary9d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
194194
var i6;
195195
var i7;
196196
var i8;
197-
var y;
197+
var x;
198198
var v;
199199
var i;
200200

201201
// Note on variable naming convention: S#, dv#, i# where # corresponds to the loop number, with `0` being the innermost loop...
202202

203-
// Resolve the output ndarray:
204-
y = arrays[ 1 ];
203+
// Resolve the input ndarray:
204+
x = arrays[ 0 ];
205205

206206
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
207-
if ( isRowMajor( y.order ) ) {
207+
if ( isRowMajor( x.order ) ) {
208208
// For row-major ndarrays, the last dimensions have the fastest changing indices...
209209
S0 = shape[ 8 ];
210210
S1 = shape[ 7 ];

0 commit comments

Comments
 (0)