XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Zpptrf()

Sub Zpptrf ( Uplo As  String,
N As  Long,
Ap() As  Complex,
Info As  Long 
)

Cholesky factorization of a Hermitian positive definite matrix in packed form

Purpose
This routine computes the Cholesky factorization of a Hermitian positive definite matrix A stored in packed form. The factorization has the form
A = U^H * U, if uplo = "U", or
A = L * L^H, if uplo = "L",
where U is an upper triangular matrix and L is a lower triangular matrix.
Parameters
[in]Uplo= "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored.
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in,out]Ap()Array Ap(LAp - 1) (LAp >= N(N + 1)/2)
[in] N x N Hermitian positive definite matrix A in packed form. The upper or lower part is to be stored in accordance with Uplo.
[out] If Info = 0, the factor U or L from the Cholesky factorization A = U^H*U or A = L*L^H.
[out]Info= 0: Successful exit.
= -1: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -2: The argument N had an illegal value. (N < 0)
= -3: The argument Ap() is invalid.
= i > 0: The leading minor of order i is not positive definite, and the factorization could not be completed.
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.20 -0.11+0.93i 0.81-0.37i )
A = ( -0.11-0.93i 2.32 -0.80+0.92i )
( 0.81+0.37i -0.80-0.92i 2.29 )
( 1.5980+1.4644i )
B = ( 1.3498+1.4398i )
( 2.0561-0.5441i )
Sub Ex_Zpptrf()
Const N As Long = 3
Dim Ap(N * (N + 1) / 2) As Complex, B(N - 1) As Complex
Dim ANorm As Double, RCond As Double, Info As Long
Ap(0) = Cmplx(2.2, 0)
Ap(1) = Cmplx(-0.11, -0.93): Ap(3) = Cmplx(2.32, 0)
Ap(2) = Cmplx(0.81, 0.37): Ap(4) = Cmplx(-0.8, -0.92): Ap(5) = Cmplx(2.29, 0)
B(0) = Cmplx(1.598, 1.4644): B(1) = Cmplx(1.3498, 1.4398): B(2) = Cmplx(2.0561, -0.5441)
ANorm = Zlansp("1", "L", N, Ap())
Call Zpptrf("L", N, Ap(), Info)
If Info = 0 Then Call Zpptrs("L", N, Ap(), B(), Info)
If Info = 0 Then Call Zppcon("L", N, Ap(), ANorm, RCond, Info)
Debug.Print "X =",
Debug.Print Creal(B(0)), Cimag(B(0)), Creal(B(1)), Cimag(B(1)), Creal(B(2)), Cimag(B(2))
Debug.Print "RCond =", RCond
Debug.Print "Info =", Info
End Sub
Example Results
X = 0.86 0.64 0.51 0.71 0.59 -0.15
RCond = 8.85790434328042E-02
Info = 0