Skip to content

Commit fb47065

Browse files
committed
chore: code revieww
--- 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: passed - 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 d384b87 commit fb47065

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

lib/node_modules/@stdlib/lapack/base/dgttrf/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.
2424
2525
<section class="intro">
2626

27-
The `dgttrf` routine computes an LU factorization of a real n-by-n tridiagonal matrix A using elimination with partial pivoting and row interchanges. The factorization has the form:
27+
The `dgttrf` routine computes an LU factorization of a real n-by-n tridiagonal matrix `A` using elimination with partial pivoting and row interchanges. The factorization has the form:
2828

2929
<!-- <equation class="equation" label="eq:lu_decomposition" align="center" raw="A = L U" alt="Equation for LU factorization."> -->
3030

@@ -36,9 +36,9 @@ A = L U
3636

3737
<!-- </equation> -->
3838

39-
where L is a product of permutation and unit lower bidiagonal matrices and U is upper triangular with nonzeros in only the main diagonal and first two superdiagonals.
39+
where `L` is a product of permutation and unit lower bidiagonal matrices and `U` is upper triangular with nonzeros in only the main diagonal and first two superdiagonals.
4040

41-
For a tridiagonal matrix A, its elements are stored in three arrays:
41+
For a tridiagonal matrix `A`, its elements are stored in three arrays:
4242

4343
<!-- <equation class="equation" label="eq:matrix_a" align="center" raw="A = \begin{bmatrix}
4444
d_1 & du_1 & 0 & \cdots & 0 \\
@@ -70,17 +70,17 @@ A = \begin{bmatrix}
7070

7171
where:
7272

73-
- `dl` contains the subdiagonal elements
74-
- `d` contains the diagonal elements
75-
- `du` contains the superdiagonal elements
73+
- `dl` contains the subdiagonal elements.
74+
- `d` contains the diagonal elements.
75+
- `du` contains the superdiagonal elements.
7676

77-
After factorization, the elements of L and U overwrite the input arrays, where:
77+
After factorization, the elements of `L` and `U` overwrite the input arrays, where:
7878

79-
- `dl` contains the multipliers that define unit lower bidiagonal matrix L
80-
- `d` contains the diagonal elements of U
81-
- `du` and `du2` contain the elements of U on the first and second superdiagonals
79+
- `dl` contains the multipliers that define unit lower bidiagonal matrix `L`.
80+
- `d` contains the diagonal elements of `U`.
81+
- `du` and `du2` contain the elements of `U` on the first and second superdiagonals.
8282

83-
The resulting L and U matrices have the following structure:
83+
The resulting `L` and `U` matrices have the following structure:
8484

8585
<!-- <equation class="equation" label="eq:matrix_l" align="center" raw="L = \begin{bmatrix}
8686
1 & 0 & 0 & \cdots & 0 \\

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
8787
return 0;
8888
}
8989

90-
idl = offsetDL;
91-
id = offsetD;
92-
idu = offsetDU;
9390
idu2 = offsetDU2;
9491
ip = offsetIPIV;
9592

@@ -109,6 +106,9 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
109106
// Set the pointers to the starting indices
110107
idu2 = offsetDU2;
111108
ip = offsetIPIV;
109+
idl = offsetDL;
110+
id = offsetD;
111+
idu = offsetDU;
112112

113113
for ( i = 0; i < N-2; i++ ) {
114114
if ( abs( D[ id ] ) >= abs( DL[ idl ] ) ) { // No row interchange required, eleminate ith element of DL
@@ -137,13 +137,8 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
137137
}
138138

139139
if ( N > 1 ) {
140+
// Perform the final (N-2)th iteration separately for the last two rows
140141
i = N - 2;
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-
147142
if ( abs( D[ id ] ) >= abs( DL[ idl ] ) ) {
148143
if ( D[ id ] !== 0 ) {
149144
fact = DL[ idl ] / D[ id ];
@@ -163,7 +158,7 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
163158

164159
id = offsetD;
165160

166-
// Check for a 0 on the diagonal of U
161+
// Check if U is singular
167162
for ( i = 0; i < N; i++ ) {
168163
if ( D[ id ] === 0.0 ) {
169164
return i;

0 commit comments

Comments
 (0)