Skip to content

Commit 27be42f

Browse files
committed
docs: add comments in base algo for better understanding
--- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 90450eb commit 27be42f

File tree

1 file changed

+6
-2
lines changed
  • lib/node_modules/@stdlib/lapack/base/dgttrf/lib

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function dgttrf( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV
7474
var ip;
7575
var i;
7676

77+
// Quick return if possible
7778
if ( N === 0 ) {
7879
return 0;
7980
}
@@ -84,22 +85,24 @@ function dgttrf( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV
8485
idu2 = odu2;
8586
ip = oi;
8687

88+
// Initialise ith element of IPIV as i
8789
for ( i = 0; i < N; i++ ) {
8890
IPIV[ ip + (si*i) ] = i;
8991
}
9092

93+
// Initialise ith element of DU2 as 0
9194
for ( i = 0; i < N-2; i++ ) {
9295
DU2[ idu + (sdu*i) ] = 0;
9396
}
9497

9598
for ( i = 0; i < N-2; i++ ) {
96-
if ( abs( D[ id + (sd*i) ] ) >= abs( DL[ idl + (sdl*i) ] ) ) { // no row interchange required
99+
if ( abs( D[ id + (sd*i) ] ) >= abs( DL[ idl + (sdl*i) ] ) ) { // No row interchange required, eleminate ith element of DL
97100
if ( D[ id ] !== 0.0 ) {
98101
fact = DL[ idl + (sdl*i) ] / D[ id + (sd*i) ];
99102
DL[ idl + (sdl*i) ] = fact;
100103
D[ id + (sd*(i+1)) ] = D[ id + (sd*(i+1)) ] - ( fact*DU[ idu + (sdu*i) ] ); // eslint-disable-line max-len
101104
}
102-
} else {
105+
} else { // Interchange the ith and (i+1)th rows and eliminate ith element of DL
103106
fact = D[ id+(sd*i) ] / DL[ idl+(sdl*i) ];
104107
D[ id+(sd*i) ] = DL[ idl+(sdl*i) ];
105108
DL[ idl+(sdl*i) ] = fact;
@@ -131,6 +134,7 @@ function dgttrf( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV
131134
}
132135
}
133136

137+
// Check for a 0 on the diagonal of U
134138
for ( i = 0; i < N; i++ ) {
135139
if ( D[ id+(sd*i) ] === 0.0 ) {
136140
return i;

0 commit comments

Comments
 (0)