Skip to content

Commit ae2b9a3

Browse files
committed
fix: use resolved order when computing loop variables
--- 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: na - 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 9bc10d4 commit ae2b9a3

File tree

10 files changed

+41
-75
lines changed

10 files changed

+41
-75
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
26-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2726
var incrementOffsets = require( './increment_offsets.js' );
2827
var setViewOffsets = require( './set_view_offsets.js' );
2928
var offsets = require( './offsets.js' );
@@ -41,6 +40,7 @@ var offsets = require( './offsets.js' );
4140
* @param {NonNegativeIntegerArray} shape - loop dimensions
4241
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4342
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4444
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4545
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4646
* @param {Options} opts - function options
@@ -159,12 +159,12 @@ var offsets = require( './offsets.js' );
159159
* };
160160
*
161161
* // Apply strided function:
162-
* unary10d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 4 ], strategy, strategy, {} );
162+
* unary10d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 12, 12, 12, 4 ], true, strategy, strategy, {} );
163163
*
164164
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
165165
* // returns [ [ [ [ [ [ [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ] ] ] ] ] ] ]
166166
*/
167-
function unary10d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-statements, max-lines-per-function
167+
function unary10d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-statements, max-lines-per-function
168168
var dv0;
169169
var dv1;
170170
var dv2;
@@ -197,17 +197,13 @@ function unary10d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, str
197197
var i7;
198198
var i8;
199199
var i9;
200-
var x;
201200
var v;
202201
var i;
203202

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

206-
// Resolve the input ndarray:
207-
x = arrays[ 0 ];
208-
209205
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
210-
if ( isRowMajor( x.order ) ) {
206+
if ( isRowMajor ) {
211207
// For row-major ndarrays, the last dimensions have the fastest changing indices...
212208
S0 = shape[ 9 ];
213209
S1 = shape[ 8 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
24-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2524
var incrementOffsets = require( './increment_offsets.js' );
2625
var setViewOffsets = require( './set_view_offsets.js' );
2726
var offsets = require( './offsets.js' );
@@ -39,6 +38,7 @@ var offsets = require( './offsets.js' );
3938
* @param {NonNegativeIntegerArray} shape - loop dimensions
4039
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4140
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4242
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4343
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4444
* @param {Options} opts - function options
@@ -157,12 +157,12 @@ var offsets = require( './offsets.js' );
157157
* };
158158
*
159159
* // Apply strided function:
160-
* unary2d( wrapper, [ x, y, initial ], views, [ 1, 3 ], [ 12, 4 ], [ 12, 4 ], strategy, strategy, {} );
160+
* unary2d( wrapper, [ x, y, initial ], views, [ 1, 3 ], [ 12, 4 ], [ 12, 4 ], true, strategy, strategy, {} );
161161
*
162162
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
163163
* // returns [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ]
164164
*/
165-
function unary2d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
165+
function unary2d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
166166
var dv0;
167167
var dv1;
168168
var S0;
@@ -171,17 +171,13 @@ function unary2d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
171171
var iv;
172172
var i0;
173173
var i1;
174-
var x;
175174
var v;
176175
var i;
177176

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

180-
// Resolve the input ndarray:
181-
x = arrays[ 0 ];
182-
183179
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
184-
if ( isRowMajor( x.order ) ) {
180+
if ( isRowMajor ) {
185181
// For row-major ndarrays, the last dimensions have the fastest changing indices...
186182
S0 = shape[ 1 ];
187183
S1 = shape[ 0 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
24-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2524
var incrementOffsets = require( './increment_offsets.js' );
2625
var setViewOffsets = require( './set_view_offsets.js' );
2726
var offsets = require( './offsets.js' );
@@ -39,6 +38,7 @@ var offsets = require( './offsets.js' );
3938
* @param {NonNegativeIntegerArray} shape - loop dimensions
4039
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4140
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4242
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4343
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4444
* @param {Options} opts - function options
@@ -157,12 +157,12 @@ var offsets = require( './offsets.js' );
157157
* };
158158
*
159159
* // Apply strided function:
160-
* unary3d( wrapper, [ x, y, initial ], views, [ 1, 1, 3 ], [ 12, 12, 4 ], [ 12, 12, 4 ], strategy, strategy, {} );
160+
* unary3d( wrapper, [ x, y, initial ], views, [ 1, 1, 3 ], [ 12, 12, 4 ], [ 12, 12, 4 ], true, strategy, strategy, {} );
161161
*
162162
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
163163
* // returns [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ]
164164
*/
165-
function unary3d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
165+
function unary3d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
166166
var dv0;
167167
var dv1;
168168
var dv2;
@@ -174,17 +174,13 @@ function unary3d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
174174
var i0;
175175
var i1;
176176
var i2;
177-
var x;
178177
var v;
179178
var i;
180179

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

183-
// Resolve the input ndarray:
184-
x = arrays[ 0 ];
185-
186182
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
187-
if ( isRowMajor( x.order ) ) {
183+
if ( isRowMajor ) {
188184
// For row-major ndarrays, the last dimensions have the fastest changing indices...
189185
S0 = shape[ 2 ];
190186
S1 = shape[ 1 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
24-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2524
var incrementOffsets = require( './increment_offsets.js' );
2625
var setViewOffsets = require( './set_view_offsets.js' );
2726
var offsets = require( './offsets.js' );
@@ -39,6 +38,7 @@ var offsets = require( './offsets.js' );
3938
* @param {NonNegativeIntegerArray} shape - loop dimensions
4039
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4140
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4242
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4343
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4444
* @param {Options} opts - function options
@@ -157,12 +157,12 @@ var offsets = require( './offsets.js' );
157157
* };
158158
*
159159
* // Apply strided function:
160-
* unary4d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 3 ], [ 12, 12, 12, 4 ], [ 12, 12, 12, 4 ], strategy, strategy, {} );
160+
* unary4d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 3 ], [ 12, 12, 12, 4 ], [ 12, 12, 12, 4 ], true, strategy, strategy, {} );
161161
*
162162
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
163163
* // returns [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ]
164164
*/
165-
function unary4d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
165+
function unary4d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
166166
var dv0;
167167
var dv1;
168168
var dv2;
@@ -177,17 +177,13 @@ function unary4d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
177177
var i1;
178178
var i2;
179179
var i3;
180-
var x;
181180
var v;
182181
var i;
183182

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

186-
// Resolve the input ndarray:
187-
x = arrays[ 0 ];
188-
189185
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
190-
if ( isRowMajor( x.order ) ) {
186+
if ( isRowMajor ) {
191187
// For row-major ndarrays, the last dimensions have the fastest changing indices...
192188
S0 = shape[ 3 ];
193189
S1 = shape[ 2 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
24-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2524
var incrementOffsets = require( './increment_offsets.js' );
2625
var setViewOffsets = require( './set_view_offsets.js' );
2726
var offsets = require( './offsets.js' );
@@ -39,6 +38,7 @@ var offsets = require( './offsets.js' );
3938
* @param {NonNegativeIntegerArray} shape - loop dimensions
4039
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4140
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
41+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4242
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4343
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4444
* @param {Options} opts - function options
@@ -157,12 +157,12 @@ var offsets = require( './offsets.js' );
157157
* };
158158
*
159159
* // Apply strided function:
160-
* unary5d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 4 ], strategy, strategy, {} );
160+
* unary5d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 4 ], true, strategy, strategy, {} );
161161
*
162162
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
163163
* // returns [ [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ] ]
164164
*/
165-
function unary5d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
165+
function unary5d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
166166
var dv0;
167167
var dv1;
168168
var dv2;
@@ -180,17 +180,13 @@ function unary5d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
180180
var i2;
181181
var i3;
182182
var i4;
183-
var x;
184183
var v;
185184
var i;
186185

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

189-
// Resolve the input ndarray:
190-
x = arrays[ 0 ];
191-
192188
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
193-
if ( isRowMajor( x.order ) ) {
189+
if ( isRowMajor ) {
194190
// For row-major ndarrays, the last dimensions have the fastest changing indices...
195191
S0 = shape[ 4 ];
196192
S1 = shape[ 3 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
26-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2726
var incrementOffsets = require( './increment_offsets.js' );
2827
var setViewOffsets = require( './set_view_offsets.js' );
2928
var offsets = require( './offsets.js' );
@@ -41,6 +40,7 @@ var offsets = require( './offsets.js' );
4140
* @param {NonNegativeIntegerArray} shape - loop dimensions
4241
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4342
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4444
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4545
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4646
* @param {Options} opts - function options
@@ -159,12 +159,12 @@ var offsets = require( './offsets.js' );
159159
* };
160160
*
161161
* // Apply strided function:
162-
* unary6d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 4 ], strategy, strategy, {} );
162+
* unary6d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 4 ], true, strategy, strategy, {} );
163163
*
164164
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
165165
* // returns [ [ [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ] ] ]
166166
*/
167-
function unary6d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
167+
function unary6d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
168168
var dv0;
169169
var dv1;
170170
var dv2;
@@ -185,17 +185,13 @@ function unary6d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
185185
var i3;
186186
var i4;
187187
var i5;
188-
var x;
189188
var v;
190189
var i;
191190

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

194-
// Resolve the input ndarray:
195-
x = arrays[ 0 ];
196-
197193
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
198-
if ( isRowMajor( x.order ) ) {
194+
if ( isRowMajor ) {
199195
// For row-major ndarrays, the last dimensions have the fastest changing indices...
200196
S0 = shape[ 5 ];
201197
S1 = shape[ 4 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
26-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2726
var incrementOffsets = require( './increment_offsets.js' );
2827
var setViewOffsets = require( './set_view_offsets.js' );
2928
var offsets = require( './offsets.js' );
@@ -41,6 +40,7 @@ var offsets = require( './offsets.js' );
4140
* @param {NonNegativeIntegerArray} shape - loop dimensions
4241
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4342
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4444
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4545
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4646
* @param {Options} opts - function options
@@ -159,12 +159,12 @@ var offsets = require( './offsets.js' );
159159
* };
160160
*
161161
* // Apply strided function:
162-
* unary7d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 4 ], strategy, strategy, {} );
162+
* unary7d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 4 ], true, strategy, strategy, {} );
163163
*
164164
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
165165
* // returns [ [ [ [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ] ] ] ]
166166
*/
167-
function unary7d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len
167+
function unary7d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len
168168
var dv0;
169169
var dv1;
170170
var dv2;
@@ -188,17 +188,13 @@ function unary7d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
188188
var i4;
189189
var i5;
190190
var i6;
191-
var x;
192191
var v;
193192
var i;
194193

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

197-
// Resolve the input ndarray:
198-
x = arrays[ 0 ];
199-
200196
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
201-
if ( isRowMajor( x.order ) ) {
197+
if ( isRowMajor ) {
202198
// For row-major ndarrays, the last dimensions have the fastest changing indices...
203199
S0 = shape[ 6 ];
204200
S1 = shape[ 5 ];

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var copyIndexed = require( '@stdlib/array/base/copy-indexed' );
26-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
2726
var incrementOffsets = require( './increment_offsets.js' );
2827
var setViewOffsets = require( './set_view_offsets.js' );
2928
var offsets = require( './offsets.js' );
@@ -41,6 +40,7 @@ var offsets = require( './offsets.js' );
4140
* @param {NonNegativeIntegerArray} shape - loop dimensions
4241
* @param {IntegerArray} stridesX - loop dimension strides for the input ndarray
4342
* @param {IntegerArray} stridesY - loop dimension strides for the output ndarray
43+
* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order
4444
* @param {Object} strategyX - strategy for marshaling data to and from an input ndarray view
4545
* @param {Object} strategyY - strategy for marshaling data to and from an output ndarray view
4646
* @param {Options} opts - function options
@@ -159,12 +159,12 @@ var offsets = require( './offsets.js' );
159159
* };
160160
*
161161
* // Apply strided function:
162-
* unary8d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 12, 4 ], strategy, strategy, {} );
162+
* unary8d( wrapper, [ x, y, initial ], views, [ 1, 1, 1, 1, 1, 1, 1, 3 ], [ 12, 12, 12, 12, 12, 12, 12, 4 ], [ 12, 12, 12, 12, 12, 12, 12, 4 ], true, strategy, strategy, {} );
163163
*
164164
* var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
165165
* // returns [ [ [ [ [ [ [ [ [ [ 1.0, 3.0 ], [ 6.0, 10.0 ] ], [ [ 5.0, 11.0 ], [ 18.0, 26.0 ] ], [ [ 9.0, 19.0 ], [ 30.0, 42.0 ] ] ] ] ] ] ] ] ] ]
166166
*/
167-
function unary8d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, strategyY, opts ) { // eslint-disable-line max-len, max-statements
167+
function unary8d( fcn, arrays, views, shape, stridesX, stridesY, isRowMajor, strategyX, strategyY, opts ) { // eslint-disable-line max-len, max-statements
168168
var dv0;
169169
var dv1;
170170
var dv2;
@@ -191,17 +191,13 @@ function unary8d( fcn, arrays, views, shape, stridesX, stridesY, strategyX, stra
191191
var i5;
192192
var i6;
193193
var i7;
194-
var x;
195194
var v;
196195
var i;
197196

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

200-
// Resolve the input ndarray:
201-
x = arrays[ 0 ];
202-
203199
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
204-
if ( isRowMajor( x.order ) ) {
200+
if ( isRowMajor ) {
205201
// For row-major ndarrays, the last dimensions have the fastest changing indices...
206202
S0 = shape[ 7 ];
207203
S1 = shape[ 6 ];

0 commit comments

Comments
 (0)