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

◆ Zgelqf()

Sub Zgelqf ( M As  Long,
N As  Long,
A() As  Complex,
Tau() As  Complex,
Info As  Long 
)

LQ factorization of a complex

Purpose
This routine computes a LQ factorization of a complex m x n matrix A.
A = L * Q
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,out]A()Array A(LA1 - 1, LA2 - 1) (LA1 >= M, LA2 >= N)
[in] M x N matrix A.
[out] The elements on and below the diagonal of the array contains the M x min(M, N) lower trapezoidal matrix L (L is lower triangular if M <= N); the elements above the diagonal, with the array Tau(), represent the unitary matrix Q as a product of 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(k) . . . H(2) H(1), where k = min(M, N).
Each H(i) has the form
H(i) = I - tau * v * v^H
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 N) is stored on exit in A(i-1, i to N-1), and tau in Tau(i-1).
Reference
LAPACK
Example Program
Compute LQ 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_Zgelqf()
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 Zgelqf(M, N, A(), Tau(), Info)
Debug.Print "L ="
Debug.Print Creal(A(0, 0)), Cimag(A(0, 0))
Debug.Print Creal(A(1, 0)), Cimag(A(1, 0)), Creal(A(1, 1)), Cimag(A(1, 1))
Debug.Print Creal(A(2, 0)), Cimag(A(2, 0)), Creal(A(2, 1)), Cimag(A(2, 1))
Debug.Print Creal(A(2, 2)), Cimag(A(2, 2))
Debug.Print "Info =", Info
Call Zunglq(M, N, K, A(), Tau(), Info)
Debug.Print "Q ="
Debug.Print Creal(A(0, 0)), Cimag(A(0, 0)), Creal(A(0, 1)), Cimag(A(0, 1))
Debug.Print Creal(A(1, 0)), Cimag(A(1, 0)), Creal(A(1, 1)), Cimag(A(1, 1))
Debug.Print Creal(A(2, 0)), Cimag(A(2, 0)), Creal(A(2, 1)), Cimag(A(2, 1))
Debug.Print Creal(A(0, 2)), Cimag(A(0, 2))
Debug.Print Creal(A(1, 2)), Cimag(A(1, 2))
Debug.Print Creal(A(2, 2)), Cimag(A(2, 2))
Debug.Print "Info =", Info
End Sub
Example Results
L =
-1.34625406220371 -0
-0.477473025372185 0.734111062500513 1.48758208444318 -0
-0.494408907417122 -0.489357854877404 -0.116513840695564 0.106275665633282
1.15135517107319 -0
Info = 0
Q =
-0.148560368815241 8.17082028483825E-02 0.69080571499087 0.237696590104386
-0.545146840380333 -0.518913702352619 0.144084009371217 0.313505787318611
0.415076807108814 0.482191168043502 0.108852269075227 0.579131158086946
-0.601669493701726 -0.274836682308196
0.101479037213067 0.551542760356437
9.33352464525714E-02 0.489131616930332
Info = 0