Skip to content

Commit 7d4e34f

Browse files
Shabareesh ShettyShabareesh Shetty
authored andcommitted
refactor: reduce arithmetic operations
--- 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 665020a commit 7d4e34f

File tree

1 file changed

+7
-4
lines changed
  • lib/node_modules/@stdlib/blas/base/dsyrk/lib

1 file changed

+7
-4
lines changed

lib/node_modules/@stdlib/blas/base/dsyrk/lib/base.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function scal( uplo, N, beta, X, strideX1, strideX2, offsetX ) { // TODO: consid
129129
var x1;
130130
var i1;
131131
var i0;
132+
var ix;
132133

133134
isrm = isRowMajor( [ strideX1, strideX2 ] );
134135

@@ -143,18 +144,20 @@ function scal( uplo, N, beta, X, strideX1, strideX2, offsetX ) { // TODO: consid
143144
( isrm && uplo === 'upper' ) || ( !isrm && uplo === 'lower' )
144145
) {
145146
for ( i1 = 0; i1 < N; i1++ ) {
147+
ix = offsetX + ( i1 * x1 );
146148
for ( i0 = i1; i0 < N; i0++ ) {
147-
idx = offsetX + ( i1 * x1 ) + ( i0 * x0 );
148-
X[ idx ] = X[ idx ] * beta;
149+
idx = ix + ( i0 * x0 );
150+
X[ idx ] *= beta;
149151
}
150152
}
151153
return X;
152154
}
153155
// ( isrm && uplo === 'lower' ) || ( !isrm && uplo === 'upper' )
154156
for ( i1 = 0; i1 < N; i1++ ) {
157+
ix = offsetX + ( i1 * x1 );
155158
for ( i0 = 0; i0 <= i1; i0++ ) {
156-
idx = offsetX + ( i1 * x1 ) + ( i0 * x0 );
157-
X[ idx ] = X[ idx ] * beta;
159+
idx = ix + ( i0 * x0 );
160+
X[ idx ] *= beta;
158161
}
159162
}
160163
return X;

0 commit comments

Comments
 (0)