|
|
◆ Zgeqrf()
| Sub Zgeqrf |
( |
M As |
Long, |
|
|
N As |
Long, |
|
|
A() As |
Complex, |
|
|
Tau() As |
Complex, |
|
|
Info As |
Long |
|
) |
| |
QR factorization of a complex matrix
- Purpose
- This routine computes a QR factorization of a complex m x n matrix A.
- 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,out] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= M, LA2 >= N)
[in] M x N matrix A.
[out] The elements on and above the diagonal of the array contains the min(M, N) x N upper trapezoidal matrix R (R is upper triangular if M >= N); the elements below the diagonal, with the array Tau(), represent the unitary matrix Q as a product of min(M, N) elementary reflectors (see Further Details). |
| [out] | Tau() | Array Tau(LTau - 1) (LTau >= min(M, N))
The scalar factors of the elementary reflectors (see Further Details). |
| [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 A() is invalid.
= -4: The argument Tau() is invalid. |
- Further Details
- The matrix Q is represented as a product of elementary reflectors
Q = H(1) H(2) . . . H(k), where k = min(M, N).
Each H(i) has the form where tau is a complex scalar, and v is a complex vector with v(1 to i-1) = 0 and v(i) = 1; v(i+1 to M) is stored on exit in A(i to M-1, i-1), and tau in Tau(i-1).
- Reference
- LAPACK
- Example Program
- Compute QR factorization of the matrix A, where
( 0.20-0.11i -0.93-0.32i 0.81+0.37i )
A = ( -0.80-0.92i -0.29+0.86i 0.64+0.51i )
( 0.71+0.59i -0.15+0.19i 0.20+0.94i )
Sub Ex_Zgeqrf()
Const M = 3, N = 3, K = N
Dim A(M - 1, N - 1) As Complex, Tau(N - 1) As Complex, Info As Long
A(0, 0) = Cmplx(0.2, -0.11): A(0, 1) = Cmplx(-0.93, -0.32): A(0, 2) = Cmplx(0.81, 0.37)
A(1, 0) = Cmplx(-0.8, -0.92): A(1, 1) = Cmplx(-0.29, 0.86): A(1, 2) = Cmplx(0.64, 0.51)
A(2, 0) = Cmplx(0.71, 0.59): A(2, 1) = Cmplx(-0.15, 0.19): A(2, 2) = Cmplx(0.2, 0.94)
Call Zgeqrf(M, N, A(), Tau(), Info)
Debug.Print "R ="
Debug.Print "Info =", Info
Call Zungqr(M, N, K, A(), Tau(), Info)
Debug.Print "Q ="
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 Zungqr(M As Long, N As Long, K As Long, A() As Complex, Tau() As Complex, Info As Long) Generates matrix Q of QR factorization of a complex matrix
Sub Zgeqrf(M As Long, N As Long, A() As Complex, Tau() As Complex, Info As Long) QR factorization of a complex matrix
- Example Results
R =
-1.54618886297891 0 0.455571771900423 0.580588841049134
0.105614523497074 -0.57774313435356
1.14235325460067 0 -0.16000635361559 -0.558214300362838
1.30543219081149 0
Info = 0
Q =
-0.129350304344243 7.11426673893335E-02 -0.726366393673366 -0.242754372725663
0.517401217376971 0.595011399983517 -0.157793930669391 0.252577062211036
-0.459193580422062 -0.381583397815516 -0.142116660471961 0.551879456556921
0.614237041991267 -0.119926029506194
5.77211185374505E-02 0.535006158572045
0.105825585638305 0.554588344523916
Info = 0
|