1 SUBROUTINE ZUNM2R
( SIDE
, TRANS
, M
, N
, K
, A
, LDA
, TAU
, C
, LDC
,
4 * -- LAPACK routine
(version
3.1) --
5 * Univ
. of Tennessee
, Univ
. of California Berkeley and NAG Ltd
..
8 * .. Scalar Arguments
..
10 INTEGER INFO
, K
, LDA
, LDC
, M
, N
12 * .. Array Arguments
..
13 COMPLEX*16 A
( LDA
, * ), C
( LDC
, * ), TAU
( * ), WORK
( * )
19 * ZUNM2R overwrites the general
complex m
-by
-n matrix C with
21 * Q
* C
if SIDE
= 'L' and TRANS
= 'N', or
23 * Q
'* C if SIDE = 'L
' and TRANS = 'C
', or
25 * C * Q if SIDE = 'R
' and TRANS = 'N
', or
27 * C * Q' if SIDE
= 'R' and TRANS
= 'C',
29 * where Q is a
complex unitary matrix defined as the product of k
30 * elementary reflectors
32 * Q
= H
(1) H
(2) . . . H
(k
)
34 * as returned by ZGEQRF
. Q is of order m
if SIDE
= 'L' and of order n
40 * SIDE
(input
) CHARACTER*1
41 * = 'L': apply Q or Q
' from the Left
42 * = 'R
': apply Q or Q' from the Right
44 * TRANS
(input
) CHARACTER*1
45 * = 'N': apply Q
(No transpose
)
46 * = 'C': apply Q
' (Conjugate transpose)
49 * The number of rows of the matrix C. M >= 0.
52 * The number of columns of the matrix C. N >= 0.
55 * The number of elementary reflectors whose product defines
57 * If SIDE = 'L
', M >= K >= 0;
58 * if SIDE = 'R
', N >= K >= 0.
60 * A (input) COMPLEX*16 array, dimension (LDA,K)
61 * The i-th column must contain the vector which defines the
62 * elementary reflector H(i), for i = 1,2,...,k, as returned by
63 * ZGEQRF in the first k columns of its array argument A.
64 * A is modified by the routine but restored on exit.
67 * The leading dimension of the array A.
68 * If SIDE = 'L
', LDA >= max(1,M);
69 * if SIDE = 'R
', LDA >= max(1,N).
71 * TAU (input) COMPLEX*16 array, dimension (K)
72 * TAU(i) must contain the scalar factor of the elementary
73 * reflector H(i), as returned by ZGEQRF.
75 * C (input/output) COMPLEX*16 array, dimension (LDC,N)
76 * On entry, the m-by-n matrix C.
77 * On exit, C is overwritten by Q*C or Q'*C or C*Q
' or C*Q.
80 * The leading dimension of the array C. LDC >= max(1,M).
82 * WORK (workspace) COMPLEX*16 array, dimension
86 * INFO (output) INTEGER
87 * = 0: successful exit
88 * < 0: if INFO = -i, the i-th argument had an illegal value
90 * =====================================================================
94 PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
98 INTEGER I, I1, I2, I3, IC, JC, MI, NI, NQ
101 * .. External Functions ..
105 * .. External Subroutines ..
106 EXTERNAL XERBLA, ZLARF
108 * .. Intrinsic Functions ..
109 INTRINSIC DCONJG, MAX
111 * .. Executable Statements ..
113 * Test the input arguments
116 LEFT = LSAME( SIDE, 'L
' )
117 NOTRAN = LSAME( TRANS, 'N
' )
119 * NQ is the order of Q
126 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R
' ) ) THEN
128 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C
' ) ) THEN
130 ELSE IF( M.LT.0 ) THEN
132 ELSE IF( N.LT.0 ) THEN
134 ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN
136 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
138 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
142 CALL XERBLA( 'ZUNM2R
', -INFO )
146 * Quick return if possible
148 IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 )
151 IF( ( LEFT .AND. .NOT.NOTRAN .OR. .NOT.LEFT .AND. NOTRAN ) ) THEN
172 * H(i) or H(i)' is applied
to C
(i
:m
,1:n
)
178 * H
(i
) or H
(i
)' is applied to C(1:m,i:n)
184 * Apply H(i) or H(i)'
189 TAUI
= DCONJG
( TAU
( I
) )
193 CALL ZLARF
( SIDE
, MI
, NI
, A
( I
, I
), 1, TAUI
, C
( IC
, JC
), LDC
,