Skip to content

Commit b28f85a

Browse files
committed
refactor: use assertion utility to check for row-major order
--- 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 b47a8a7 commit b28f85a

27 files changed

+162
-27
lines changed

lib/node_modules/@stdlib/ndarray/base/every/lib/10d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -105,7 +110,7 @@ function every10d( x ) { // eslint-disable-line max-statements
105110
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
106111
sh = x.shape;
107112
sx = x.strides;
108-
if ( x.order === 'row-major' ) {
113+
if ( isRowMajor( x.order ) ) {
109114
// For row-major ndarrays, the last dimensions have the fastest changing indices...
110115
S0 = sh[ 9 ];
111116
S1 = sh[ 8 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/10d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -109,7 +114,7 @@ function every10d( x ) { // eslint-disable-line max-statements
109114
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
110115
sh = x.shape;
111116
sx = x.strides;
112-
if ( x.order === 'row-major' ) {
117+
if ( isRowMajor( x.order ) ) {
113118
// For row-major ndarrays, the last dimensions have the fastest changing indices...
114119
S0 = sh[ 9 ];
115120
S1 = sh[ 8 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/10d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -105,7 +110,7 @@ function every10d( x ) { // eslint-disable-line max-statements
105110
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
106111
sh = x.shape;
107112
sx = x.strides;
108-
if ( x.order === 'row-major' ) {
113+
if ( isRowMajor( x.order ) ) {
109114
// For row-major ndarrays, the last dimensions have the fastest changing indices...
110115
S0 = sh[ 9 ];
111116
S1 = sh[ 8 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/2d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -79,7 +84,7 @@ function every2d( x ) {
7984
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8085
sh = x.shape;
8186
sx = x.strides;
82-
if ( x.order === 'row-major' ) {
87+
if ( isRowMajor( x.order ) ) {
8388
// For row-major ndarrays, the last dimensions have the fastest changing indices...
8489
S0 = sh[ 1 ];
8590
S1 = sh[ 0 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/2d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -83,7 +88,7 @@ function every2d( x ) {
8388
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8489
sh = x.shape;
8590
sx = x.strides;
86-
if ( x.order === 'row-major' ) {
91+
if ( isRowMajor( x.order ) ) {
8792
// For row-major ndarrays, the last dimensions have the fastest changing indices...
8893
S0 = sh[ 1 ];
8994
S1 = sh[ 0 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/2d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -79,7 +84,7 @@ function every2d( x ) {
7984
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8085
sh = x.shape;
8186
sx = x.strides;
82-
if ( x.order === 'row-major' ) {
87+
if ( isRowMajor( x.order ) ) {
8388
// For row-major ndarrays, the last dimensions have the fastest changing indices...
8489
S0 = sh[ 1 ];
8590
S1 = sh[ 0 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/3d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -82,7 +87,7 @@ function every3d( x ) {
8287
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8388
sh = x.shape;
8489
sx = x.strides;
85-
if ( x.order === 'row-major' ) {
90+
if ( isRowMajor( x.order ) ) {
8691
// For row-major ndarrays, the last dimensions have the fastest changing indices...
8792
S0 = sh[ 2 ];
8893
S1 = sh[ 1 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/3d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -86,7 +91,7 @@ function every3d( x ) {
8691
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8792
sh = x.shape;
8893
sx = x.strides;
89-
if ( x.order === 'row-major' ) {
94+
if ( isRowMajor( x.order ) ) {
9095
// For row-major ndarrays, the last dimensions have the fastest changing indices...
9196
S0 = sh[ 2 ];
9297
S1 = sh[ 1 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/3d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -82,7 +87,7 @@ function every3d( x ) {
8287
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8388
sh = x.shape;
8489
sx = x.strides;
85-
if ( x.order === 'row-major' ) {
90+
if ( isRowMajor( x.order ) ) {
8691
// For row-major ndarrays, the last dimensions have the fastest changing indices...
8792
S0 = sh[ 2 ];
8893
S1 = sh[ 1 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/4d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -85,7 +90,7 @@ function every4d( x ) {
8590
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8691
sh = x.shape;
8792
sx = x.strides;
88-
if ( x.order === 'row-major' ) {
93+
if ( isRowMajor( x.order ) ) {
8994
// For row-major ndarrays, the last dimensions have the fastest changing indices...
9095
S0 = sh[ 3 ];
9196
S1 = sh[ 2 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/4d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -89,7 +94,7 @@ function every4d( x ) {
8994
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
9095
sh = x.shape;
9196
sx = x.strides;
92-
if ( x.order === 'row-major' ) {
97+
if ( isRowMajor( x.order ) ) {
9398
// For row-major ndarrays, the last dimensions have the fastest changing indices...
9499
S0 = sh[ 3 ];
95100
S1 = sh[ 2 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/4d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -85,7 +90,7 @@ function every4d( x ) {
8590
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
8691
sh = x.shape;
8792
sx = x.strides;
88-
if ( x.order === 'row-major' ) {
93+
if ( isRowMajor( x.order ) ) {
8994
// For row-major ndarrays, the last dimensions have the fastest changing indices...
9095
S0 = sh[ 3 ];
9196
S1 = sh[ 2 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/5d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -90,7 +95,7 @@ function every5d( x ) {
9095
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
9196
sh = x.shape;
9297
sx = x.strides;
93-
if ( x.order === 'row-major' ) {
98+
if ( isRowMajor( x.order ) ) {
9499
// For row-major ndarrays, the last dimensions have the fastest changing indices...
95100
S0 = sh[ 4 ];
96101
S1 = sh[ 3 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/5d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -94,7 +99,7 @@ function every5d( x ) {
9499
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
95100
sh = x.shape;
96101
sx = x.strides;
97-
if ( x.order === 'row-major' ) {
102+
if ( isRowMajor( x.order ) ) {
98103
// For row-major ndarrays, the last dimensions have the fastest changing indices...
99104
S0 = sh[ 4 ];
100105
S1 = sh[ 3 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/5d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -90,7 +95,7 @@ function every5d( x ) {
9095
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
9196
sh = x.shape;
9297
sx = x.strides;
93-
if ( x.order === 'row-major' ) {
98+
if ( isRowMajor( x.order ) ) {
9499
// For row-major ndarrays, the last dimensions have the fastest changing indices...
95100
S0 = sh[ 4 ];
96101
S1 = sh[ 3 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/6d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -93,7 +98,7 @@ function every6d( x ) {
9398
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
9499
sh = x.shape;
95100
sx = x.strides;
96-
if ( x.order === 'row-major' ) {
101+
if ( isRowMajor( x.order ) ) {
97102
// For row-major ndarrays, the last dimensions have the fastest changing indices...
98103
S0 = sh[ 5 ];
99104
S1 = sh[ 4 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/6d_accessors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -97,7 +102,7 @@ function every6d( x ) {
97102
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
98103
sh = x.shape;
99104
sx = x.strides;
100-
if ( x.order === 'row-major' ) {
105+
if ( isRowMajor( x.order ) ) {
101106
// For row-major ndarrays, the last dimensions have the fastest changing indices...
102107
S0 = sh[ 5 ];
103108
S1 = sh[ 4 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/6d_complex.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -93,7 +98,7 @@ function every6d( x ) {
9398
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
9499
sh = x.shape;
95100
sx = x.strides;
96-
if ( x.order === 'row-major' ) {
101+
if ( isRowMajor( x.order ) ) {
97102
// For row-major ndarrays, the last dimensions have the fastest changing indices...
98103
S0 = sh[ 5 ];
99104
S1 = sh[ 4 ];

lib/node_modules/@stdlib/ndarray/base/every/lib/7d.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
'use strict';
2222

23+
// MODULES //
24+
25+
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
26+
27+
2328
// MAIN //
2429

2530
/**
@@ -96,7 +101,7 @@ function every7d( x ) {
96101
// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...
97102
sh = x.shape;
98103
sx = x.strides;
99-
if ( x.order === 'row-major' ) {
104+
if ( isRowMajor( x.order ) ) {
100105
// For row-major ndarrays, the last dimensions have the fastest changing indices...
101106
S0 = sh[ 6 ];
102107
S1 = sh[ 5 ];

0 commit comments

Comments
 (0)