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

◆ Zunmlq()

Sub Zunmlq ( Side As  String,
Trans As  String,
M As  Long,
N As  Long,
K As  Long,
A() As  Complex,
Tau() As  Complex,
C() As  Complex,
Info As  Long 
)

Multiplies matrix by Q of LQ factorization of a complex matrix

Purpose
This routine overwrites the general complex m x n matrix C with
Side = "L" Side = "R"
Trans = "N": Q * C C * Q
Trans = "C": Q^H * C C * Q^H
where Q is a real orthogonal matrix defined as the product of k elementary reflectors
Q = H(k) . . . H(2) H(1)
as returned by Dgelqf. Q is of order m if Side = "L" and of order n if Side = "R".
Parameters
[in]Side= "L": Apply Q or Q^H from the left.
= "R": Apply Q or Q^H from the right.
[in]Trans= "N": No transpose, apply Q.
= "C": Conjugate transpose, apply Q^H.
[in]MNumber of rows of the matrix C. (M >= 0) (If M = 0, returns without computation)
[in]NNumber of columns of the matrix C. (N >= 0) (If N = 0, returns without computation)
[in]KNumber of elementary reflectors whose product defines the matrix Q. (M => K >= 0 if Side = "L", N >= K >= 0 if Side = "R") (If K = 0, returns without computation)
[in]A()Array A(LA1 - 1, LA2 - 1) (LA1 >= K, LA2 >= M (Side = "L") or N (Side = "R"))
The i-th row must contain the vector which defines the elementary reflector H(i), for i = 1, 2, ..., K, as returned by Zgelqf in the first K rows of its array argument A().
[in]Tau()Array Tau(LTau - 1) (LTau >= K)
The scalar factors of the elementary reflectors H(i) as returned by Zgelqf.
[in,out]C()Array C(LC1 - 1, LC2 - 1) (LC1 >= M, LC2 >= N)
[in] M x N matrix C.
[out] C() is overwritten by Q*C or Q^H*C or C*Q^H or C*Q.
[out]Info= 0: Successful exit.
= -1: The argument Side had an illegal value. (Side <> "L" nor "R")
= -2: The argument Trans had an illegal value. (Trans <> "C" nor "N")
= -3: The argument M had an illegal value. (M < 0)
= -4: The argument N had an illegal value. (N < 0)
= -5: The argument K had an illegal value. (K < 0, or K > M (Side = "L") or N (Side = "R"))
= -6: The argument A() is invalid.
= -7: The argument Tau() is invalid.
= -8: The argument C() is invalid.
Reference
LAPACK
Example Program
Compute LQ factorization of the matrix A, and compute L*Q, 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_Zunmlq()
Const M = 3, N = 3, K = N
Dim A(M - 1, N - 1) As Complex, Tau(N - 1) As Complex, Info As Long
Dim L(M - 1, N - 1) As Complex, I As Long, J 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)
For I = 0 To M - 1
For J = 0 To I
L(I, J) = A(I, J)
Next
Next
Debug.Print "L ="
Debug.Print Creal(L(0, 0)), Cimag(L(0, 0))
Debug.Print Creal(L(1, 0)), Cimag(L(1, 0)), Creal(L(1, 1)), Cimag(L(1, 1))
Debug.Print Creal(L(2, 0)), Cimag(L(2, 0)), Creal(L(2, 1)), Cimag(L(2, 1))
Debug.Print Creal(L(2, 2)), Cimag(L(2, 2))
Debug.Print "Info =", Info
Call Zunmlq("R", "N", M, N, K, A(), Tau(), L(), Info)
Debug.Print "L*Q ="
Debug.Print Creal(L(0, 0)), Cimag(L(0, 0)), Creal(L(0, 1)), Cimag(L(0, 1)), Creal(L(0, 2)), Cimag(L(0, 2))
Debug.Print Creal(L(1, 0)), Cimag(L(1, 0)), Creal(L(1, 1)), Cimag(L(1, 1)), Creal(L(1, 2)), Cimag(L(1, 2))
Debug.Print Creal(L(2, 0)), Cimag(L(2, 0)), Creal(L(2, 1)), Cimag(L(2, 1)), Creal(L(2, 2)), Cimag(L(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
L*Q =
0.2 -0.11 -0.93 -0.32 0.81 0.37
-0.8 -0.92 -0.29 0.86 0.64 0.51
0.71 0.59 -0.15 0.19 0.2 0.94
Info = 0