3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZUNMTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunmtr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunmtr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunmtr.f">
21 * SUBROUTINE ZUNMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS, UPLO
26 * INTEGER INFO, LDA, LDC, LWORK, M, N
28 * .. Array Arguments ..
29 * COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
38 *> ZUNMTR overwrites the general complex M-by-N matrix C with
40 *> SIDE = 'L' SIDE = 'R'
41 *> TRANS = 'N': Q * C C * Q
42 *> TRANS = 'C': Q**H * C C * Q**H
44 *> where Q is a complex unitary matrix of order nq, with nq = m if
45 *> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
46 *> nq-1 elementary reflectors, as returned by ZHETRD:
48 *> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
50 *> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
58 *> SIDE is CHARACTER*1
59 *> = 'L': apply Q or Q**H from the Left;
60 *> = 'R': apply Q or Q**H from the Right.
65 *> UPLO is CHARACTER*1
66 *> = 'U': Upper triangle of A contains elementary reflectors
68 *> = 'L': Lower triangle of A contains elementary reflectors
74 *> TRANS is CHARACTER*1
75 *> = 'N': No transpose, apply Q;
76 *> = 'C': Conjugate transpose, apply Q**H.
82 *> The number of rows of the matrix C. M >= 0.
88 *> The number of columns of the matrix C. N >= 0.
93 *> A is COMPLEX*16 array, dimension
94 *> (LDA,M) if SIDE = 'L'
95 *> (LDA,N) if SIDE = 'R'
96 *> The vectors which define the elementary reflectors, as
97 *> returned by ZHETRD.
103 *> The leading dimension of the array A.
104 *> LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
109 *> TAU is COMPLEX*16 array, dimension
110 *> (M-1) if SIDE = 'L'
111 *> (N-1) if SIDE = 'R'
112 *> TAU(i) must contain the scalar factor of the elementary
113 *> reflector H(i), as returned by ZHETRD.
118 *> C is COMPLEX*16 array, dimension (LDC,N)
119 *> On entry, the M-by-N matrix C.
120 *> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
126 *> The leading dimension of the array C. LDC >= max(1,M).
131 *> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
132 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
138 *> The dimension of the array WORK.
139 *> If SIDE = 'L', LWORK >= max(1,N);
140 *> if SIDE = 'R', LWORK >= max(1,M).
141 *> For optimum performance LWORK >= N*NB if SIDE = 'L', and
142 *> LWORK >=M*NB if SIDE = 'R', where NB is the optimal
145 *> If LWORK = -1, then a workspace query is assumed; the routine
146 *> only calculates the optimal size of the WORK array, returns
147 *> this value as the first entry of the WORK array, and no error
148 *> message related to LWORK is issued by XERBLA.
154 *> = 0: successful exit
155 *> < 0: if INFO = -i, the i-th argument had an illegal value
161 *> \author Univ. of Tennessee
162 *> \author Univ. of California Berkeley
163 *> \author Univ. of Colorado Denver
166 *> \date November 2011
168 *> \ingroup complex16OTHERcomputational
170 * =====================================================================
171 SUBROUTINE ZUNMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
172 $ WORK, LWORK, INFO )
174 * -- LAPACK computational routine (version 3.4.0) --
175 * -- LAPACK is a software package provided by Univ. of Tennessee, --
176 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179 * .. Scalar Arguments ..
180 CHARACTER SIDE, TRANS, UPLO
181 INTEGER INFO, LDA, LDC, LWORK, M, N
183 * .. Array Arguments ..
184 COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
187 * =====================================================================
189 * .. Local Scalars ..
190 LOGICAL LEFT, LQUERY, UPPER
191 INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
193 * .. External Functions ..
196 EXTERNAL LSAME, ILAENV
198 * .. External Subroutines ..
199 EXTERNAL XERBLA, ZUNMQL, ZUNMQR
201 * .. Intrinsic Functions ..
204 * .. Executable Statements ..
206 * Test the input arguments
209 LEFT = LSAME( SIDE, 'L' )
210 UPPER = LSAME( UPLO, 'U' )
211 LQUERY = ( LWORK.EQ.-1 )
213 * NQ is the order of Q and NW is the minimum dimension of WORK
222 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
224 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
226 ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.LSAME( TRANS, 'C' ) )
229 ELSE IF( M.LT.0 ) THEN
231 ELSE IF( N.LT.0 ) THEN
233 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
235 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
237 ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
244 NB = ILAENV( 1, 'ZUNMQL', SIDE // TRANS, M-1, N, M-1,
247 NB = ILAENV( 1, 'ZUNMQL', SIDE // TRANS, M, N-1, N-1,
252 NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M-1, N, M-1,
255 NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M, N-1, N-1,
259 LWKOPT = MAX( 1, NW )*NB
264 CALL XERBLA( 'ZUNMTR', -INFO )
266 ELSE IF( LQUERY ) THEN
270 * Quick return if possible
272 IF( M.EQ.0 .OR. N.EQ.0 .OR. NQ.EQ.1 ) THEN
287 * Q was determined by a call to ZHETRD with UPLO = 'U'
289 CALL ZUNMQL( SIDE, TRANS, MI, NI, NQ-1, A( 1, 2 ), LDA, TAU, C,
290 $ LDC, WORK, LWORK, IINFO )
293 * Q was determined by a call to ZHETRD with UPLO = 'L'
302 CALL ZUNMQR( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU,
303 $ C( I1, I2 ), LDC, WORK, LWORK, IINFO )