Skip to content

Commit ba24b53

Browse files
committed
refactor: base implementation refactoring
--- 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 7f1a1c7 commit ba24b53

File tree

1 file changed

+37
-25
lines changed
  • lib/node_modules/@stdlib/lapack/base/dgttrf/lib

1 file changed

+37
-25
lines changed

lib/node_modules/@stdlib/lapack/base/dgttrf/lib/base.js

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,41 +111,53 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
111111
ip = offsetIPIV;
112112

113113
for ( i = 0; i < N-2; i++ ) {
114-
if ( abs( D[ id + (strideD*i) ] ) >= abs( DL[ idl + (strideDL*i) ] ) ) { // No row interchange required, eleminate ith element of DL
114+
if ( abs( D[ id ] ) >= abs( DL[ idl ] ) ) { // No row interchange required, eleminate ith element of DL
115115
if ( D[ id ] !== 0.0 ) {
116-
fact = DL[ idl + (strideDL*i) ] / D[ id + (strideD*i) ];
117-
DL[ idl + (strideDL*i) ] = fact;
118-
D[ id + (strideD*(i+1)) ] = D[ id + (strideD*(i+1)) ] - ( fact*DU[ idu + (strideDU*i) ] ); // eslint-disable-line max-len
116+
fact = DL[ idl ] / D[ id ];
117+
DL[ idl ] = fact;
118+
D[ id + strideD ] = D[ id + strideD ] - ( fact*DU[ idu ] );
119119
}
120120
} else { // Interchange the ith and (i+1)th rows and eliminate ith element of DL
121-
fact = D[ id+(strideD*i) ] / DL[ idl+(strideDL*i) ];
122-
D[ id+(strideD*i) ] = DL[ idl+(strideDL*i) ];
123-
DL[ idl+(strideDL*i) ] = fact;
124-
temp = DU[ idu+(strideDU*i) ];
125-
DU[ idu+(strideDU*i) ] = D[ id + (strideD*(i+1)) ];
126-
D[ id+(strideD*(i+1)) ] = temp - ( fact*D[ id+(strideD*(i+1)) ] );
127-
DU2[ idu2+(strideDU2*i) ] = DU[ idu+(strideDU*(i+1)) ];
128-
DU[ idu+(strideDU*(i+1)) ] = -fact*DU[ idu+(strideDU*(i+1)) ];
129-
IPIV[ ip+(strideIPIV*i) ] = i + 1;
121+
fact = D[ id ] / DL[ idl ];
122+
D[ id ] = DL[ idl ];
123+
DL[ idl ] = fact;
124+
temp = DU[ idu ];
125+
DU[ idu ] = D[ id + strideD ];
126+
D[ id + strideD ] = temp - ( fact*D[ id + strideD ] );
127+
DU2[ idu2 ] = DU[ idu + strideDU ];
128+
DU[ idu + strideDU ] = -fact*DU[ idu + strideDU ];
129+
IPIV[ ip ] = i + 1;
130130
}
131+
132+
id += strideD;
133+
idl += strideDL;
134+
idu += strideDU;
135+
idu2 += strideDU2;
136+
ip += strideIPIV;
131137
}
132138

133139
if ( N > 1 ) {
134140
i = N - 2;
135-
if ( abs( D[ id + (strideD*i) ] ) >= abs( DL[ idl + (strideDL*i) ] ) ) {
136-
if ( D[ id + (strideD*i) ] !== 0 ) {
137-
fact = DL[ idl + (strideDL*i) ] / D[ id + (strideD*i) ];
138-
DL[ idl + (strideDL*i) ] = fact;
139-
D[ id + (strideD*(i+1)) ] = D[ id + (strideD*(i+1)) ] - (fact*DU[ idu + (strideDU*i) ]); // eslint-disable-line max-len
141+
idl = offsetDL + ( strideDL * i );
142+
id = offsetD + ( strideD * i );
143+
idu = offsetDU + ( strideDU * i );
144+
idu2 = offsetDU2 + ( strideDU2 * i );
145+
ip = offsetIPIV + ( strideIPIV * i );
146+
147+
if ( abs( D[ id ] ) >= abs( DL[ idl ] ) ) {
148+
if ( D[ id ] !== 0 ) {
149+
fact = DL[ idl ] / D[ id ];
150+
DL[ idl ] = fact;
151+
D[ id + strideD ] = D[ id + strideD ] - ( fact * DU[ idu ] );
140152
}
141153
} else {
142-
fact = D[ id+(strideD*i) ] / DL[ idl+(strideDL*i) ];
143-
D[ id+(strideD*i) ] = DL[ idl+(strideDL*i) ];
144-
DL[ idl+(strideDL*i) ] = fact;
145-
temp = DU[ idu+(strideDU*i) ];
146-
DU[ idu+(strideDU*i) ] = D[ id + (strideD*(i+1)) ];
147-
D[ id+(strideD*(i+1)) ] = temp - ( fact*D[ id+(strideD*(i+1)) ] );
148-
IPIV[ ip+(strideIPIV*i) ] = i + 1;
154+
fact = D[ id ] / DL[ idl ];
155+
D[ id ] = DL[ idl ];
156+
DL[ idl ] = fact;
157+
temp = DU[ idu ];
158+
DU[ idu ] = D[ id + strideD ];
159+
D[ id + strideD ] = temp - ( fact*D[ id + strideD ] );
160+
IPIV[ ip ] = i + 1;
149161
}
150162
}
151163

0 commit comments

Comments
 (0)