XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Dgbtrf()

Sub Dgbtrf ( M As  Long,
N As  Long,
Kl As  Long,
Ku As  Long,
Ab() As  Double,
IPiv() As  Long,
Info As  Long 
)

LU factorization of a general band matrix

Purpose
This routine computes an LU factorization of a real m x n band matrix A using partial pivoting with row interchanges.
This is the blocked version of the algorithm calling Level 3 BLAS.
Parameters
[in]MNumber of rows of the matrix A. (M >= 0) (If M = 0, returns without computation)
[in]NNumber of columns of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in]KlNumber of subdiagonals within the band of A (Kl >= 0)
[in]KuNumber of superdiagonals within the band of A (Ku >= 0)
[in,out]Ab()Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= 2Kl + Ku + 1, LAb2 >= N)
[in] The matrix A in band matrix form, in rows Kl+1 to 2Kl+Ku+1; rows 1 to Kl of the array need not be set.
[out] Details of the factorization: U is stored as an upper triangular band matrix with kl+ku super-diagonals in rows 1 to Kl+Ku+1, and the multipliers used during the factorization are stored in rows Kl+Ku+2 to 2*Kl+Ku+1.
See below for further details.
[out]IPiv()Array IPiv(LIPiv - 1) (LIPiv >= N)
Pivot indices; for 1 <= i <= min(M, N), row i of the matrix was interchanged with row IPiv(i-1).
[out]Info= 0: Successful exit.
= -1: The argument M had an illegal value. (M < 0)
= -2: The argument N had an illegal value. (N < 0)
= -3: The argument Kl had an illegal value. (Kl < 0)
= -4: The argument Ku had an illegal value. (Ku < 0)
= -5: The argument Ab() is invalid.
= -6: The argument IPiv() is invalid.
= i > 0: The i-th diagonal element of the factor U is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Further Details
The band matrix form is illustrated by the following example, when M = N = 6, Kl = 2, Ku = 1:
On entry:
   *    *    *    +    +    +
   *    *    +    +    +    +
   *   a12  a23  a34  a45  a56
  a11  a22  a33  a44  a55  a66
  a21  a32  a43  a54  a65   *
  a31  a42  a53  a64   *    *

On exit:
   *    *    *   u14  u25  u36
   *    *   u13  u24  u35  u46
   *   u12  u23  u34  u45  u56
  u11  u22  u33  u44  u55  u66
  m21  m32  m43  m54  m65   *
  m31  m42  m53  m64   *    *
Array elements marked * are not used by the routine; elements marked + need not be set on entry, but are required by the routine to store elements of U because of fill-in resulting from the row interchanges.
Reference
LAPACK
Example Program
Solve the system of linear equations Ax = B and estimate the reciprocal of the condition number (RCond) of A, where
( 2.34 0.57 0 ) ( 0.7416 )
A = ( 0.65 1.98 -1.39 ), B = ( 0.7885 )
( 0 1.50 1.73 ) ( 1.0833 )
Sub Ex_Dgbtrf()
Const N = 3, Kl = 1, Ku = 1
Dim Ab(2 * Kl + Ku, N - 1) As Double, B(N - 1) As Double, IPiv(N - 1) As Long
Dim ANorm As Double, RCond As Double, Info As Long
Ab(1, 0) = 0: Ab(1, 1) = 0.57: Ab(1, 2) = -1.39
Ab(2, 0) = 2.34: Ab(2, 1) = 1.98: Ab(2, 2) = 1.73
Ab(3, 0) = 0.65: Ab(3, 1) = 1.5: Ab(3, 2) = 0
B(0) = 0.7416: B(1) = 0.7885: B(2) = 1.0833
ANorm = Dlangb("1", N, Kl, Ku, Ab(), , Kl)
Call Dgbtrf(N, N, Kl, Ku, Ab(), IPiv(), Info)
If Info = 0 Then Call Dgbtrs("N", N, Kl, Ku, Ab(), IPiv(), B(), Info)
If Info = 0 Then Call Dgbcon("1", N, Kl, Ku, Ab(), IPiv(), ANorm, RCond, Info)
Debug.Print "X =", B(0), B(1), B(2)
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Dlangb(Norm As String, N As Long, Kl As Long, Ku As Long, Ab() As Double, Optional Info As Long, Optional Offset As Long=0) As Double
One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a general band m...
Sub Dgbtrs(Trans As String, N As Long, Kl As Long, Ku As Long, Ab() As Double, IPiv() As Long, B() As Double, Info As Long, Optional Nrhs As Long=1)
Solution to LU factorized system of linear equations AX = B or ATX = B for a general band matrix
Sub Dgbtrf(M As Long, N As Long, Kl As Long, Ku As Long, Ab() As Double, IPiv() As Long, Info As Long)
LU factorization of a general band matrix
Sub Dgbcon(Norm As String, N As Long, Kl As Long, Ku As Long, Ab() As Double, IPiv() As Long, ANorm As Double, RCond As Double, Info As Long)
Condition number of a general band matrix
Example Results
X = 0.2 0.48 0.21
RCond = 0.364187455306431
Info = 0