|
|
◆ Zgbtrf()
| Sub Zgbtrf |
( |
M As |
Long, |
|
|
N As |
Long, |
|
|
Kl As |
Long, |
|
|
Ku As |
Long, |
|
|
Ab() As |
Complex, |
|
|
IPiv() As |
Long, |
|
|
Info As |
Long |
|
) |
| |
LU factorization of a complex band matrix
- Purpose
- This routine computes an LU factorization of a complex 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] | M | Number of rows of the matrix A. (M >= 0) (If M = 0, returns without computation) |
| [in] | N | Number of columns of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in] | Kl | Number of subdiagonals within the band of A (Kl >= 0) |
| [in] | Ku | Number 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
( 0.81+0.37i 0.20-0.11i 0 )
A = ( 0.64+0.51i -0.80-0.92i -0.93-0.32i )
( 0 0.71+0.59i -0.29+0.86i )
( -0.0484+0.2644i )
B = ( -0.2644-1.0228i )
( -0.5299+1.5025i )
Sub Ex_Zgbtrf()
Const N = 3, Kl = 1, Ku = 1
Dim Ab(2 * Kl + Ku, N - 1) As Complex, B(N - 1) As Complex, IPiv(N - 1) As Long
Dim ANorm As Double, RCond As Double, Info As Long
Ab(1, 1) = Cmplx(0.2, -0.11): Ab(1, 2) = Cmplx(-0.93, -0.32)
Ab(2, 0) = Cmplx(0.81, 0.37): Ab(2, 1) = Cmplx(-0.8, -0.92): Ab(2, 2) = Cmplx(-0.29, 0.86)
Ab(3, 0) = Cmplx(0.64, 0.51): Ab(3, 1) = Cmplx(0.71, 0.59)
B(0) = Cmplx(-0.0484, 0.2644): B(1) = Cmplx(-0.2644, -1.0228): B(2) = Cmplx(-0.5299, 1.5025)
ANorm = Zlangb("1", N, Kl, Ku, Ab(), , Kl)
Call Zgbtrf(N, N, Kl, Ku, Ab(), IPiv(), Info)
If Info = 0 Then Call Zgbtrs("N", N, Kl, Ku, Ab(), IPiv(), B(), Info)
If Info = 0 Then Call Zgbcon("1", N, Kl, Ku, Ab(), IPiv(), ANorm, RCond, Info)
Debug.Print "X =",
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Function Cmplx(R As Double, Optional I As Double=0) As Complex Building complex number
Function Cimag(A As Complex) As Double Imaginary part of complex number
Function Creal(A As Complex) As Double Real part of complex number
Function Zlangb(Norm As String, N As Long, Kl As Long, Ku As Long, Ab() As Complex, Optional Info As Long, Optional Offset As Long) As Double One norm, Frobenius norm, infinity norm, or largest absolute value of any element of a complex band m...
Sub Zgbtrf(M As Long, N As Long, Kl As Long, Ku As Long, Ab() As Complex, IPiv() As Long, Info As Long) LU factorization of a complex band matrix
Sub Zgbcon(Norm As String, N As Long, Kl As Long, Ku As Long, Ab() As Complex, IPiv() As Long, ANorm As Double, RCond As Double, Info As Long) Condition number of a complex band matrix
Sub Zgbtrs(Trans As String, N As Long, Kl As Long, Ku As Long, Ab() As Complex, IPiv() As Long, B() As Complex, Info As Long, Optional Nrhs As Long=1) Solution to LU factorized system of linear equations AX = B, ATX = B or AHX = B for a complex band ma...
- Example Results
X = -0.15 0.19 0.2 0.94 0.79 -0.13
RCond = 0.187722560135325
Info = 0
|