|
|
◆ Zhetri()
| Sub Zhetri |
( |
Uplo As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Complex, |
|
|
IPiv() As |
Long, |
|
|
Info As |
Long |
|
) |
| |
Inverse of a Hermitian matrix
- Purpose
- This routine computes the inverse of a Hermitian matrix A using the factorization A = U*D*U^H or A = L*D*L^H computed by zhetrf.
- Parameters
-
| [in] | Uplo | Specifies whether the details of the factorization are stored as an upper or lower triangular matrix.
= "U": Upper triangular, form is A = U*D*U^H.
= "L": Lower triangular, form is A = L*D*L^H. |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by Zhetrf.
[out] If Info = 0, the (symmetric) inverse of the original matrix A. The upper or lower triangular part of the inverse is formed and the other part of A() below or above the diagonal is not referenced in accordance with Uplo. |
| [in] | IPiv() | Array IPiv(LIPiv - 1) (LIPiv >= N)
Details of the interchanges and the block structure of D as determined by Zhetrf. |
| [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 A() is invalid.
= -4: The argument IPiv() is invalid.
= i > 0: The i-th element of D is exactly zero; the matrix is singular and its inverse could not be computed. |
- Reference
- LAPACK
- Example Program
- Compute the inverse matrix of A, where
( 0.20 -0.11+0.93i 0.81-0.37i )
A = ( -0.11-0.93i -0.32 -0.80+0.92i )
( 0.81+0.37i -0.80-0.92i -0.29 )
とする. Sub Ex_Zhetri()
Const N = 3
Dim A(N - 1, N - 1) As Complex, IPiv(N - 1) As Long, Info As Long
A(1, 0) = Cmplx(-0.11, -0.93): A(1, 1) = Cmplx(-0.32, 0)
A(2, 0) = Cmplx(0.81, 0.37): A(2, 1) = Cmplx(-0.8, -0.92): A(2, 2) = Cmplx(-0.29, 0)
Call Zhetrf("L", N, A(), IPiv(), Info)
If Info = 0 Then Call Zhetri("L", N, A(), IPiv(), Info)
Debug.Print "Inv(A) ="
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
Sub Zhetrf(Uplo As String, N As Long, A() As Complex, IPiv() As Long, Info As Long) UDUH or LDLH factorization of a Hermitian matrix
Sub Zhetri(Uplo As String, N As Long, A() As Complex, IPiv() As Long, Info As Long) Inverse of a Hermitian matrix
- Example Results
Inv(A) =
3.5853396244861 0 0 0
0 0
2.62494404338631 -0.461802857775011 2.18938290789155 0
0 0
1.30796976541958 -2.47907094012256 0.702866522251437 -2.3066988427915
2.42092751624671 0
Info = 0
|