From d04bbf9e334b57377af0f7f760d19f106cf16e0c Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 16 Sep 2025 08:11:00 +0530 Subject: [PATCH 01/12] 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 --- --- .../@stdlib/lapack/base/README.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 26b6cbe0402a..f62aae536cf2 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -22,6 +22,159 @@ limitations under the License. > Base (i.e., lower-level) linear algebra package (LAPACK) routines. +
+ +## Band Storage + +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. + +### General Band Matrix Storage + +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. + +**Storage Mapping:** + +- Columns of the original matrix are stored in corresponding columns of the array `AB` +- Diagonals of the matrix are stored in rows of the array `AB` +- Element `A( i, j )` from the original matrix is stored in `AB(KU+1+i-j, j)` +- Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)` + +#### Example (M=N=5, KL=2, KU=1) + +Original band matrix `A`: + + + +```math +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] +``` + + + +Band storage in array `AB` (4×5, since KL+KU+1 = 2+1+1 = 4): + + + +```math +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] +``` + + + +Elements marked `*` need not be set and are not referenced by LAPACK routines. + +**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. + +### Triangular Band Matrices + +Triangular band matrices are stored in the same format as general band matrices: + +- If `KL = 0`, the matrix is upper triangular +- If `KU = 0`, the matrix is lower triangular + +### Symmetric or Hermitian Band Matrices + +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. + +**Upper Triangle Storage (UPLO = 'U'):** + +- Element `A( i, j )` is stored in `AB(KD+1+i-j, j)` +- Valid range for `i`: `max(1, j-KD) <= i <= j` + +**Lower Triangle Storage (UPLO = 'L'):** + +- Element `A( i, j )` is stored in `AB(1+i-j, j)` +- Valid range for `i`: `j <= i <= min(N, j+KD)` + +#### Example (N=5, KD=2) + +For `UPLO = 'U'` (upper triangle stored): + + + +```math +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] +``` + + + +Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3): + + + +```math +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] +``` + + + +For `UPLO = 'L'` (lower triangle stored): + + + +```math +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] +``` + + + +Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3): + + + +```math +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] +``` + + + +
+ + +
## Usage From 5e9bfc5d0aa1a06b1ed3ceeb76c6401dcd7920a4 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:21:31 -0700 Subject: [PATCH 02/12] docs: update copy Signed-off-by: Athan --- .../@stdlib/lapack/base/README.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index f62aae536cf2..9a7f3c67d49f 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -34,14 +34,14 @@ A general band matrix of size `M`-by-`N` with `KL` subdiagonals and `KU` superdi **Storage Mapping:** -- Columns of the original matrix are stored in corresponding columns of the array `AB` -- Diagonals of the matrix are stored in rows of the array `AB` -- Element `A( i, j )` from the original matrix is stored in `AB(KU+1+i-j, j)` -- Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)` +- Columns of the original matrix are stored in corresponding columns of the array `AB`. +- Diagonals of the matrix are stored in rows of the array `AB`. +- Element `A[i, j]` from the original matrix is stored in `AB[KU+1+i-j, j]`. +- Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)`. -#### Example (M=N=5, KL=2, KU=1) +#### Example -Original band matrix `A`: +Let `M = N = 5`, `KL = 2`, and `KU = 1`. Given an original band matrix `A` @@ -59,7 +59,7 @@ A = \left[ -Band storage in array `AB` (4×5, since KL+KU+1 = 2+1+1 = 4): +the band storage matrix `AB` is then @@ -76,34 +76,34 @@ AB = \left[ -Elements marked `*` need not be set and are not referenced by LAPACK routines. +`AB` is a 4×5 matrix as `KL+KU+1 = 2+1+1 = 4`. Elements marked `*` need not be set and are not referenced by LAPACK routines. -**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. +**Note:** When a band matrix is supplied for LU factorization, space must be allowed to store an additional `KL` superdiagonals, which are 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. ### Triangular Band Matrices Triangular band matrices are stored in the same format as general band matrices: -- If `KL = 0`, the matrix is upper triangular -- If `KU = 0`, the matrix is lower triangular +- If `KL = 0`, the matrix is upper triangular. +- If `KU = 0`, the matrix is lower triangular. ### Symmetric or Hermitian Band Matrices -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. +For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonals, only the upper or lower triangle (as specified by an `UPLO` parameter) needs to be stored. **Upper Triangle Storage (UPLO = 'U'):** -- Element `A( i, j )` is stored in `AB(KD+1+i-j, j)` +- Element `A[i, j]` is stored in `AB[KD+1+i-j, j]`. - Valid range for `i`: `max(1, j-KD) <= i <= j` **Lower Triangle Storage (UPLO = 'L'):** -- Element `A( i, j )` is stored in `AB(1+i-j, j)` -- Valid range for `i`: `j <= i <= min(N, j+KD)` +- Element `A[i, j]` is stored in `AB[1+i-j, j]`. +- Valid range for `i`: `j <= i <= min(N, j+KD)`. -#### Example (N=5, KD=2) +#### Example -For `UPLO = 'U'` (upper triangle stored): +Let `N = 5` and `KD = 2`. Given the following matrix `A`, @@ -121,7 +121,7 @@ A = \left[ -Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3): +the band storage matrix `AB` when `UPLO = 'U'` (i.e., upper triangle) is @@ -137,7 +137,7 @@ AB = \left[ -For `UPLO = 'L'` (lower triangle stored): +The matrix is 3×5 as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, @@ -155,7 +155,7 @@ A = \left[ -Band storage in array `AB` (3×5, since KD+1 = 2+1 = 3): +the band storage matrix `AB` (3×5, since KD+1 = 2+1 = 3) when `UPLO = 'L'` (i.e., lower triangle) is From a165f271ead28f61bf1d8236f08775dd028fefc4 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:22:56 -0700 Subject: [PATCH 03/12] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 9a7f3c67d49f..fa256357ed17 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -137,7 +137,7 @@ AB = \left[ -The matrix is 3×5 as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, +`AB` is a 3×5 matrix is 3×5 as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, @@ -155,7 +155,7 @@ A = \left[ -the band storage matrix `AB` (3×5, since KD+1 = 2+1 = 3) when `UPLO = 'L'` (i.e., lower triangle) is +the band storage matrix `AB` when `UPLO = 'L'` (i.e., lower triangle) is @@ -169,6 +169,8 @@ AB = \left[ \right] ``` +`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. +
From c418f0c22456d98e7e525ced771e7b3899167ffb Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:25:57 -0700 Subject: [PATCH 04/12] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index fa256357ed17..1eb97b66c182 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -26,7 +26,7 @@ limitations under the License. ## Band Storage -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. +Many LAPACK routines work with banded matrices, which are stored compactly in two-dimensional arrays to save memory and improve computational efficiency. The following are the different band storage formats used throughout LAPACK. ### General Band Matrix Storage From 1d53da9addfbd6782914bd0848e45c27257a76ee Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:27:02 -0700 Subject: [PATCH 05/12] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 1eb97b66c182..7204a8f60436 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -26,7 +26,7 @@ limitations under the License. ## Band Storage -Many LAPACK routines work with banded matrices, which are stored compactly in two-dimensional arrays to save memory and improve computational efficiency. The following are the different band storage formats used throughout LAPACK. +Many LAPACK routines work with banded matrices, which are stored compactly in two-dimensional arrays arranged in linear memory in order to save memory and improve computational efficiency. The following are the different band storage formats used throughout LAPACK. ### General Band Matrix Storage From 39830265f8f845febe44b2f1fa4cbe57c6773d6e Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:28:31 -0700 Subject: [PATCH 06/12] docs: add missing period Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 7204a8f60436..565397fbf33e 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -94,7 +94,7 @@ For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonal **Upper Triangle Storage (UPLO = 'U'):** - Element `A[i, j]` is stored in `AB[KD+1+i-j, j]`. -- Valid range for `i`: `max(1, j-KD) <= i <= j` +- Valid range for `i`: `max(1, j-KD) <= i <= j`. **Lower Triangle Storage (UPLO = 'L'):** From 461abb7c3468c2185d920ac3733a7a8748cbda41 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:29:07 -0700 Subject: [PATCH 07/12] docs: fix copy Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 565397fbf33e..060a3086c330 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -137,7 +137,7 @@ AB = \left[ -`AB` is a 3×5 matrix is 3×5 as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, +`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, From 4a6139230e6e87a586a971770780f8b8904f6b0b Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:31:09 -0700 Subject: [PATCH 08/12] style: align ampersands Signed-off-by: Athan --- .../@stdlib/lapack/base/README.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 060a3086c330..43468f30f0b6 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -110,11 +110,11 @@ Let `N = 5` and `KD = 2`. Given the following matrix `A`, ```math 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} + 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] ``` @@ -144,11 +144,11 @@ AB = \left[ ```math 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} + 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] ``` From 939a824a5a639997f3d2f9749fe66479b0024137 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Sep 2025 22:40:56 -0700 Subject: [PATCH 09/12] style: remove trailing whitespace Signed-off-by: Athan --- lib/node_modules/@stdlib/lapack/base/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 43468f30f0b6..c49e4914e446 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -169,7 +169,7 @@ AB = \left[ \right] ``` -`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. +`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. From b284d11a42b1cb13a7e44555696b10ec1838ef29 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 17 Sep 2025 20:47:03 +0530 Subject: [PATCH 10/12] chore: remove newlines --- 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 --- --- lib/node_modules/@stdlib/lapack/base/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index c49e4914e446..2a3a1099854f 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -43,7 +43,7 @@ A general band matrix of size `M`-by-`N` with `KL` subdiagonals and `KU` superdi Let `M = N = 5`, `KL = 2`, and `KU = 1`. Given an original band matrix `A` - + ```math A = \left[ @@ -61,7 +61,7 @@ A = \left[ the band storage matrix `AB` is then - + ```math AB = \left[ @@ -105,7 +105,7 @@ For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonal Let `N = 5` and `KD = 2`. Given the following matrix `A`, - + ```math A = \left[ @@ -123,7 +123,7 @@ A = \left[ the band storage matrix `AB` when `UPLO = 'U'` (i.e., upper triangle) is - + ```math AB = \left[ @@ -139,7 +139,7 @@ AB = \left[ `AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, - + ```math A = \left[ @@ -157,7 +157,7 @@ A = \left[ the band storage matrix `AB` when `UPLO = 'L'` (i.e., lower triangle) is - + ```math AB = \left[ From d41266ab6c9f48749b5f2a3adb4515ef096d7abf Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 21 Sep 2025 10:18:49 +0530 Subject: [PATCH 11/12] docs: add example --- 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 --- --- .../@stdlib/lapack/base/README.md | 88 +++++++++++++++---- 1 file changed, 70 insertions(+), 18 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 2a3a1099854f..1a1a162901bd 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -30,13 +30,13 @@ Many LAPACK routines work with banded matrices, which are stored compactly in tw ### General Band Matrix Storage -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. +A general band matrix of size `M`-by-`N` with `KL` subdiagonals and `KU` superdiagonals is stored in a two-dimensional array `A` with `KL+KU+1` rows and `N` columns. **Storage Mapping:** -- Columns of the original matrix are stored in corresponding columns of the array `AB`. -- Diagonals of the matrix are stored in rows of the array `AB`. -- Element `A[i, j]` from the original matrix is stored in `AB[KU+1+i-j, j]`. +- Columns of the original matrix are stored in corresponding columns of the array `A`. +- Diagonals of the matrix are stored in rows of the array `A`. +- Element `A[i, j]` from the original matrix is stored in `A[KU+1+i-j, j]`. - Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)`. #### Example @@ -59,12 +59,12 @@ A = \left[ -the band storage matrix `AB` is then +the band storage matrix `A` is then - + ```math -AB = \left[ +A = \left[ \begin{array}{rrrrr} * & a_{12} & a_{23} & a_{34} & a_{45} \\ a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\ @@ -76,7 +76,7 @@ AB = \left[ -`AB` is a 4×5 matrix as `KL+KU+1 = 2+1+1 = 4`. Elements marked `*` need not be set and are not referenced by LAPACK routines. +`A` is a 4×5 matrix as `KL+KU+1 = 2+1+1 = 4`. Elements marked `*` need not be set and are not referenced by LAPACK routines. **Note:** When a band matrix is supplied for LU factorization, space must be allowed to store an additional `KL` superdiagonals, which are 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. @@ -93,12 +93,12 @@ For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonal **Upper Triangle Storage (UPLO = 'U'):** -- Element `A[i, j]` is stored in `AB[KD+1+i-j, j]`. +- Element `A[i, j]` is stored in `A[KD+1+i-j, j]`. - Valid range for `i`: `max(1, j-KD) <= i <= j`. **Lower Triangle Storage (UPLO = 'L'):** -- Element `A[i, j]` is stored in `AB[1+i-j, j]`. +- Element `A[i, j]` is stored in `A[1+i-j, j]`. - Valid range for `i`: `j <= i <= min(N, j+KD)`. #### Example @@ -121,12 +121,12 @@ A = \left[ -the band storage matrix `AB` when `UPLO = 'U'` (i.e., upper triangle) is +the band storage matrix `A` when `UPLO = 'U'` (i.e., upper triangle) is - + ```math -AB = \left[ +A = \left[ \begin{array}{rrrrr} * & * & a_{13} & a_{24} & a_{35} \\ * & a_{12} & a_{23} & a_{34} & a_{45} \\ @@ -137,7 +137,7 @@ AB = \left[ -`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, +`A` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, @@ -155,12 +155,12 @@ A = \left[ -the band storage matrix `AB` when `UPLO = 'L'` (i.e., lower triangle) is +the band storage matrix `A` when `UPLO = 'L'` (i.e., lower triangle) is - + ```math -AB = \left[ +A = \left[ \begin{array}{rrrrr} a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\ a_{21} & a_{32} & a_{43} & a_{54} & * \\ @@ -169,10 +169,62 @@ AB = \left[ \right] ``` -`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. +`A` is a 3×5 matrix as `KD+1 = 2+1 = 3`. + + + +### Example + +Consider a 4×4 general band matrix with `KL = 2` subdiagonals and `KU = 1` superdiagonal: + + + +```math +A = \left[ +\begin{array}{rrrr} + 1.0 & 2.0 & 0.0 & 0.0 \\ + 3.0 & 4.0 & 5.0 & 0.0 \\ + 6.0 & 7.0 & 8.0 & 9.0 \\ + 0.0 & 10.0 & 11.0 & 12.0 +\end{array} +\right] +``` + + + +#### Band Storage Representation + +The band storage matrix `A` has dimensions `(KL+KU+1) × N = (2+1+1) × 4 = 4 × 4`: + + + +```math +A = \left[ +\begin{array}{rrrr} + * & 2.0 & 5.0 & 9.0 \\ + 1.0 & 4.0 & 8.0 & 12.0 \\ + 3.0 & 7.0 & 11.0 & * \\ + 6.0 & 10.0 & * & * +\end{array} +\right] +``` +Here's how to represent this band matrix in JavaScript using `Float64Array`: + +##### Row-Major Layout + +```javascript +var A = new Float64Array( [ 0.0, 2.0, 5.0, 9.0, 1.0, 4.0, 8.0, 12.0, 3.0, 7.0, 11.0, 0.0, 6.0, 10.0, 0.0, 0.0 ] ); +``` + +##### Column-Major Layout + +```javascript +var A = new Float64Array( [ 0.0, 1.0, 3.0, 6.0, 2.0, 4.0, 7.0, 10.0, 5.0, 8.0, 11.0, 0.0, 9.0, 12.0, 0.0, 0.0 ] ); +``` + From 1bc74d49fec029256a86ab3c15e27de859818680 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 22 Sep 2025 14:26:00 +0530 Subject: [PATCH 12/12] fix: fix search and replace error --- 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 --- --- .../@stdlib/lapack/base/README.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/README.md b/lib/node_modules/@stdlib/lapack/base/README.md index 1a1a162901bd..96829f5e6651 100644 --- a/lib/node_modules/@stdlib/lapack/base/README.md +++ b/lib/node_modules/@stdlib/lapack/base/README.md @@ -30,13 +30,13 @@ Many LAPACK routines work with banded matrices, which are stored compactly in tw ### General Band Matrix Storage -A general band matrix of size `M`-by-`N` with `KL` subdiagonals and `KU` superdiagonals is stored in a two-dimensional array `A` with `KL+KU+1` rows and `N` columns. +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. **Storage Mapping:** -- Columns of the original matrix are stored in corresponding columns of the array `A`. -- Diagonals of the matrix are stored in rows of the array `A`. -- Element `A[i, j]` from the original matrix is stored in `A[KU+1+i-j, j]`. +- Columns of the original matrix are stored in corresponding columns of the array `AB`. +- Diagonals of the matrix are stored in rows of the array `AB`. +- Element `A[i, j]` from the original matrix is stored in `AB[KU+1+i-j, j]`. - Valid range for `i`: `max(1, j-KU) <= i <= min(M, j+KL)`. #### Example @@ -59,12 +59,12 @@ A = \left[ -the band storage matrix `A` is then +the band storage matrix `AB` is then - + ```math -A = \left[ +AB = \left[ \begin{array}{rrrrr} * & a_{12} & a_{23} & a_{34} & a_{45} \\ a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\ @@ -76,7 +76,7 @@ A = \left[ -`A` is a 4×5 matrix as `KL+KU+1 = 2+1+1 = 4`. Elements marked `*` need not be set and are not referenced by LAPACK routines. +`AB` is a 4×5 matrix as `KL+KU+1 = 2+1+1 = 4`. Elements marked `*` need not be set and are not referenced by LAPACK routines. **Note:** When a band matrix is supplied for LU factorization, space must be allowed to store an additional `KL` superdiagonals, which are 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. @@ -93,12 +93,12 @@ For symmetric or Hermitian band matrices with `KD` subdiagonals or superdiagonal **Upper Triangle Storage (UPLO = 'U'):** -- Element `A[i, j]` is stored in `A[KD+1+i-j, j]`. +- Element `A[i, j]` is stored in `AB[KD+1+i-j, j]`. - Valid range for `i`: `max(1, j-KD) <= i <= j`. **Lower Triangle Storage (UPLO = 'L'):** -- Element `A[i, j]` is stored in `A[1+i-j, j]`. +- Element `A[i, j]` is stored in `AB[1+i-j, j]`. - Valid range for `i`: `j <= i <= min(N, j+KD)`. #### Example @@ -121,12 +121,12 @@ A = \left[ -the band storage matrix `A` when `UPLO = 'U'` (i.e., upper triangle) is +the band storage matrix `AB` when `UPLO = 'U'` (i.e., upper triangle) is - + ```math -A = \left[ +AB = \left[ \begin{array}{rrrrr} * & * & a_{13} & a_{24} & a_{35} \\ * & a_{12} & a_{23} & a_{34} & a_{45} \\ @@ -137,7 +137,7 @@ A = \left[ -`A` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, +`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. Similarly, given the following matrix `A`, @@ -155,12 +155,12 @@ A = \left[ -the band storage matrix `A` when `UPLO = 'L'` (i.e., lower triangle) is +the band storage matrix `AB` when `UPLO = 'L'` (i.e., lower triangle) is - + ```math -A = \left[ +AB = \left[ \begin{array}{rrrrr} a_{11} & a_{22} & a_{33} & a_{44} & a_{55} \\ a_{21} & a_{32} & a_{43} & a_{54} & * \\ @@ -169,7 +169,7 @@ A = \left[ \right] ``` -`A` is a 3×5 matrix as `KD+1 = 2+1 = 3`. +`AB` is a 3×5 matrix as `KD+1 = 2+1 = 3`. @@ -194,12 +194,12 @@ A = \left[ #### Band Storage Representation -The band storage matrix `A` has dimensions `(KL+KU+1) × N = (2+1+1) × 4 = 4 × 4`: +The band storage matrix `AB` has dimensions `(KL+KU+1) × N = (2+1+1) × 4 = 4 × 4`: - + ```math -A = \left[ +AB = \left[ \begin{array}{rrrr} * & 2.0 & 5.0 & 9.0 \\ 1.0 & 4.0 & 8.0 & 12.0 \\ @@ -216,13 +216,13 @@ Here's how to represent this band matrix in JavaScript using `Float64Array`: ##### Row-Major Layout ```javascript -var A = new Float64Array( [ 0.0, 2.0, 5.0, 9.0, 1.0, 4.0, 8.0, 12.0, 3.0, 7.0, 11.0, 0.0, 6.0, 10.0, 0.0, 0.0 ] ); +var AB = new Float64Array( [ 0.0, 2.0, 5.0, 9.0, 1.0, 4.0, 8.0, 12.0, 3.0, 7.0, 11.0, 0.0, 6.0, 10.0, 0.0, 0.0 ] ); ``` ##### Column-Major Layout ```javascript -var A = new Float64Array( [ 0.0, 1.0, 3.0, 6.0, 2.0, 4.0, 7.0, 10.0, 5.0, 8.0, 11.0, 0.0, 9.0, 12.0, 0.0, 0.0 ] ); +var AB = new Float64Array( [ 0.0, 1.0, 3.0, 6.0, 2.0, 4.0, 7.0, 10.0, 5.0, 8.0, 11.0, 0.0, 9.0, 12.0, 0.0, 0.0 ] ); ```