Skip to content

Commit d04bbf9

Browse files
committed
docs: add banded matrices intro section in lapack/base
--- 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: na - 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 d686540 commit d04bbf9

File tree

1 file changed

+153
-0
lines changed
  • lib/node_modules/@stdlib/lapack/base

1 file changed

+153
-0
lines changed

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

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,159 @@ limitations under the License.
2222

2323
> Base (i.e., lower-level) linear algebra package (LAPACK) routines.
2424
25+
<section class="intro">
26+
27+
## Band Storage
28+
29+
Many LAPACK routines work with banded matrices, which are stored compactly in two-dimensional arrays to save memory and improve computational efficiency. This section describes the different band storage formats used throughout the LAPACK library.
30+
31+
### General Band Matrix Storage
32+
33+
A general band matrix of size `M`-by-`N` with `KL` subdiagonals and `KU` superdiagonals is stored in a two-dimensional array `AB` with `KL+KU+1` rows and `N` columns.
34+
35+
**Storage Mapping:**
36+
37+
- Columns of the original matrix are stored in corresponding columns of the array `AB`
38+
- Diagonals of the matrix are stored in rows of the array `AB`
39+
- Element `A( i, j )` from the original matrix is stored in `AB(KU+1+i-j, j)`
40+
- Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)`
41+
42+
#### Example (M=N=5, KL=2, KU=1)
43+
44+
Original band matrix `A`:
45+
46+
<!-- <equation class="equation" label="eq:band_matrix_a" align="center" raw="A = \left[\begin{array}{rrrrr}a_{11} & a_{12} & 0 & 0 & 0 \\a_{21} & a_{22} & a_{23} & 0 & 0 \\a_{31} & a_{32} & a_{33} & a_{34} & 0 \\0 & a_{42} & a_{43} & a_{44} & a_{45} \\0 & 0 & a_{53} & a_{54} & a_{55}\end{array}\right]" alt="Representation of band matrix A."> -->
47+
48+
```math
49+
A = \left[
50+
\begin{array}{rrrrr}
51+
a_{11} & a_{12} & 0 & 0 & 0 \\
52+
a_{21} & a_{22} & a_{23} & 0 & 0 \\
53+
a_{31} & a_{32} & a_{33} & a_{34} & 0 \\
54+
0 & a_{42} & a_{43} & a_{44} & a_{45} \\
55+
0 & 0 & a_{53} & a_{54} & a_{55}
56+
\end{array}
57+
\right]
58+
```
59+
60+
<!-- </equation> -->
61+
62+
Band storage in array `AB` (4×5, since KL+KU+1 = 2+1+1 = 4):
63+
64+
<!-- <equation class="equation" label="eq:band_storage_ab" align="center" raw="AB = \left[\begin{array}{rrrrr}* & a_{12} & a_{23} & a_{34} & a_{45} \\a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\a_{21} & a_{32} & a_{43} & a_{54} & * \\a_{31} & a_{42} & a_{53} & * & *\end{array}\right]" alt="Band storage representation of matrix A."> -->
65+
66+
```math
67+
AB = \left[
68+
\begin{array}{rrrrr}
69+
* & a_{12} & a_{23} & a_{34} & a_{45} \\
70+
a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\
71+
a_{21} & a_{32} & a_{43} & a_{54} & * \\
72+
a_{31} & a_{42} & a_{53} & * & *
73+
\end{array}
74+
\right]
75+
```
76+
77+
<!-- </equation> -->
78+
79+
Elements marked `*` need not be set and are not referenced by LAPACK routines.
80+
81+
**Note:** When a band matrix is supplied for LU factorization, space must be allowed to store an additional `KL` superdiagonals, generated by fill-in as a result of row interchanges. This means that the matrix is stored according to the above scheme, but with `KL + KU` superdiagonals.
82+
83+
### Triangular Band Matrices
84+
85+
Triangular band matrices are stored in the same format as general band matrices:
86+
87+
- If `KL = 0`, the matrix is upper triangular
88+
- If `KU = 0`, the matrix is lower triangular
89+
90+
### Symmetric or Hermitian Band Matrices
91+
92+
For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonals, only the upper or lower triangle (as specified by `UPLO`) needs to be stored.
93+
94+
**Upper Triangle Storage (UPLO = 'U'):**
95+
96+
- Element `A( i, j )` is stored in `AB(KD+1+i-j, j)`
97+
- Valid range for `i`: `max(1, j-KD) <= i <= j`
98+
99+
**Lower Triangle Storage (UPLO = 'L'):**
100+
101+
- Element `A( i, j )` is stored in `AB(1+i-j, j)`
102+
- Valid range for `i`: `j <= i <= min(N, j+KD)`
103+
104+
#### Example (N=5, KD=2)
105+
106+
For `UPLO = 'U'` (upper triangle stored):
107+
108+
<!-- <equation class="equation" label="eq:symmetric_upper_a" align="center" raw="A = \left[\begin{array}{rrrrr}a_{11} & a_{12} & a_{13} & 0 & 0 \\{a_{12}} & a_{22} & a_{23} & a_{24} & 0 \\{a_{13}} & {a_{23}} & a_{33} & a_{34} & a_{35} \\0 & {a_{24}} & {a_{34}} & a_{44} & a_{45} \\0 & 0 & {a_{35}} & {a_{45}} & a_{55}\end{array}\right]" alt="Representation of symmetric band matrix A (upper triangle)."> -->
109+
110+
```math
111+
A = \left[
112+
\begin{array}{rrrrr}
113+
a_{11} & a_{12} & a_{13} & 0 & 0 \\
114+
{a_{12}} & a_{22} & a_{23} & a_{24} & 0 \\
115+
{a_{13}} & {a_{23}} & a_{33} & a_{34} & a_{35} \\
116+
0 & {a_{24}} & {a_{34}} & a_{44} & a_{45} \\
117+
0 & 0 & {a_{35}} & {a_{45}} & a_{55}
118+
\end{array}
119+
\right]
120+
```
121+
122+
<!-- </equation> -->
123+
124+
Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3):
125+
126+
<!-- <equation class="equation" label="eq:symmetric_upper_ab" align="center" raw="AB = \left[\begin{array}{rrrrr}* & * & a_{13} & a_{24} & a_{35} \\* & a_{12} & a_{23} & a_{34} & a_{45} \\a_{11} & a_{22} & a_{33} & a_{44} & a_{55}\end{array}\right]" alt="Band storage representation of symmetric matrix A (upper triangle)."> -->
127+
128+
```math
129+
AB = \left[
130+
\begin{array}{rrrrr}
131+
* & * & a_{13} & a_{24} & a_{35} \\
132+
* & a_{12} & a_{23} & a_{34} & a_{45} \\
133+
a_{11} & a_{22} & a_{33} & a_{44} & a_{55}
134+
\end{array}
135+
\right]
136+
```
137+
138+
<!-- </equation> -->
139+
140+
For `UPLO = 'L'` (lower triangle stored):
141+
142+
<!-- <equation class="equation" label="eq:symmetric_lower_a" align="center" raw="A = \left[\begin{array}{rrrrr}a_{11} & {a_{21}} & {a_{31}} & 0 & 0 \\a_{21} & a_{22} & {a_{32}} & {a_{42}} & 0 \\a_{31} & a_{32} & a_{33} & {a_{43}} & {a_{53}} \\0 & a_{42} & a_{43} & a_{44} & {a_{54}} \\0 & 0 & a_{53} & a_{54} & a_{55}\end{array}\right]" alt="Representation of symmetric band matrix A (lower triangle)."> -->
143+
144+
```math
145+
A = \left[
146+
\begin{array}{rrrrr}
147+
a_{11} & {a_{21}} & {a_{31}} & 0 & 0 \\
148+
a_{21} & a_{22} & {a_{32}} & {a_{42}} & 0 \\
149+
a_{31} & a_{32} & a_{33} & {a_{43}} & {a_{53}} \\
150+
0 & a_{42} & a_{43} & a_{44} & {a_{54}} \\
151+
0 & 0 & a_{53} & a_{54} & a_{55}
152+
\end{array}
153+
\right]
154+
```
155+
156+
<!-- </equation> -->
157+
158+
Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3):
159+
160+
<!-- <equation class="equation" label="eq:symmetric_lower_ab" align="center" raw="AB = \left[\begin{array}{rrrrr}a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\a_{21} & a_{32} & a_{43} & a_{54} & * \\a_{31} & a_{42} & a_{53} & * & *\end{array}\right]" alt="Band storage representation of symmetric matrix A (lower triangle)."> -->
161+
162+
```math
163+
AB = \left[
164+
\begin{array}{rrrrr}
165+
a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\
166+
a_{21} & a_{32} & a_{43} & a_{54} & * \\
167+
a_{31} & a_{42} & a_{53} & * & *
168+
\end{array}
169+
\right]
170+
```
171+
172+
<!-- </equation> -->
173+
174+
</section>
175+
176+
<!-- /.intro -->
177+
25178
<section class="usage">
26179

27180
## Usage

0 commit comments

Comments
 (0)