Skip to content

Commit 5695176

Browse files
committed
fix: offset increment calc
--- 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 486a493 commit 5695176

File tree

1 file changed

+6
-6
lines changed
  • lib/node_modules/@stdlib/ndarray/base/unary-reduce-subarray/lib

1 file changed

+6
-6
lines changed

lib/node_modules/@stdlib/ndarray/base/unary-reduce-subarray/lib/3d_accessors.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,28 +133,28 @@ function unary3d( fcn, arrays, views, strides, opts ) {
133133
S0 = sh[ 2 ];
134134
S1 = sh[ 1 ];
135135
S2 = sh[ 0 ];
136-
dv0 = [ strides[2] ];
136+
dv0 = [ strides[2] ]; // offset increment for innermost loop
137137
dv1 = [ strides[1] - ( S0*strides[2] ) ];
138-
dv2 = [ strides[0] - ( S1*strides[1] ) - ( S0*strides[2] ) ];
138+
dv2 = [ strides[0] - ( S1*strides[1] ) ]; // offset increment for outermost loop
139139
for ( i = 1; i < arrays.length; i++ ) {
140140
sv = arrays[ i ].strides;
141141
dv0.push( sv[2] );
142142
dv1.push( sv[1] - ( S0*sv[2] ) );
143-
dv2.push( sv[0] - ( S1*sv[1] ) - ( S0*sv[2] ) );
143+
dv2.push( sv[0] - ( S1*sv[1] ) );
144144
}
145145
} else {
146146
// For column-major ndarrays, the first dimensions have the fastest changing indices...
147147
S0 = sh[ 0 ];
148148
S1 = sh[ 1 ];
149149
S2 = sh[ 2 ];
150-
dv0 = [ strides[0] ];
150+
dv0 = [ strides[0] ]; // offset increment for innermost loop
151151
dv1 = [ strides[1] - ( S0*strides[0] ) ];
152-
dv2 = [ strides[2] - ( S1*strides[1] ) - ( S0*strides[2] ) ];
152+
dv2 = [ strides[2] - ( S1*strides[1] ) ]; // offset increment for outermost loop
153153
for ( i = 1; i < arrays.length; i++ ) {
154154
sv = arrays[ i ].strides;
155155
dv0.push( sv[0] );
156156
dv1.push( sv[1] - ( S0*sv[0] ) );
157-
dv2.push( sv[2] - ( S1*sv[1] ) - ( S0*sv[2] ) );
157+
dv2.push( sv[2] - ( S1*sv[1] ) );
158158
}
159159
}
160160
// Resolve a list of pointers to the first indexed elements in the respective ndarrays:

0 commit comments

Comments
 (0)