3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CUPMTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cupmtr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cupmtr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cupmtr.f">
21 * SUBROUTINE CUPMTR( SIDE, UPLO, TRANS, M, N, AP, TAU, C, LDC, WORK,
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS, UPLO
26 * INTEGER INFO, LDC, M, N
28 * .. Array Arguments ..
29 * COMPLEX AP( * ), C( LDC, * ), TAU( * ), WORK( * )
38 *> CUPMTR 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 CHPTRD using packed
49 *> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
51 *> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
59 *> SIDE is CHARACTER*1
60 *> = 'L': apply Q or Q**H from the Left;
61 *> = 'R': apply Q or Q**H from the Right.
66 *> UPLO is CHARACTER*1
67 *> = 'U': Upper triangular packed storage used in previous
69 *> = 'L': Lower triangular packed storage used in previous
75 *> TRANS is CHARACTER*1
76 *> = 'N': No transpose, apply Q;
77 *> = 'C': Conjugate transpose, apply Q**H.
83 *> The number of rows of the matrix C. M >= 0.
89 *> The number of columns of the matrix C. N >= 0.
94 *> AP is COMPLEX array, dimension
95 *> (M*(M+1)/2) if SIDE = 'L'
96 *> (N*(N+1)/2) if SIDE = 'R'
97 *> The vectors which define the elementary reflectors, as
98 *> returned by CHPTRD. AP is modified by the routine but
104 *> TAU is COMPLEX array, dimension (M-1) if SIDE = 'L'
105 *> or (N-1) if SIDE = 'R'
106 *> TAU(i) must contain the scalar factor of the elementary
107 *> reflector H(i), as returned by CHPTRD.
112 *> C is COMPLEX array, dimension (LDC,N)
113 *> On entry, the M-by-N matrix C.
114 *> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
120 *> The leading dimension of the array C. LDC >= max(1,M).
125 *> WORK is COMPLEX array, dimension
133 *> = 0: successful exit
134 *> < 0: if INFO = -i, the i-th argument had an illegal value
140 *> \author Univ. of Tennessee
141 *> \author Univ. of California Berkeley
142 *> \author Univ. of Colorado Denver
145 *> \date November 2011
147 *> \ingroup complexOTHERcomputational
149 * =====================================================================
150 SUBROUTINE CUPMTR( SIDE, UPLO, TRANS, M, N, AP, TAU, C, LDC, WORK,
153 * -- LAPACK computational routine (version 3.4.0) --
154 * -- LAPACK is a software package provided by Univ. of Tennessee, --
155 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
158 * .. Scalar Arguments ..
159 CHARACTER SIDE, TRANS, UPLO
160 INTEGER INFO, LDC, M, N
162 * .. Array Arguments ..
163 COMPLEX AP( * ), C( LDC, * ), TAU( * ), WORK( * )
166 * =====================================================================
170 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) )
172 * .. Local Scalars ..
173 LOGICAL FORWRD, LEFT, NOTRAN, UPPER
174 INTEGER I, I1, I2, I3, IC, II, JC, MI, NI, NQ
177 * .. External Functions ..
181 * .. External Subroutines ..
182 EXTERNAL CLARF, XERBLA
184 * .. Intrinsic Functions ..
187 * .. Executable Statements ..
189 * Test the input arguments
192 LEFT = LSAME( SIDE, 'L' )
193 NOTRAN = LSAME( TRANS, 'N' )
194 UPPER = LSAME( UPLO, 'U' )
196 * NQ is the order of Q
203 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
205 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
207 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
209 ELSE IF( M.LT.0 ) THEN
211 ELSE IF( N.LT.0 ) THEN
213 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
217 CALL XERBLA( 'CUPMTR', -INFO )
221 * Quick return if possible
223 IF( M.EQ.0 .OR. N.EQ.0 )
228 * Q was determined by a call to CHPTRD with UPLO = 'U'
230 FORWRD = ( LEFT .AND. NOTRAN ) .OR.
231 $ ( .NOT.LEFT .AND. .NOT.NOTRAN )
242 II = NQ*( NQ+1 ) / 2 - 1
254 * H(i) or H(i)**H is applied to C(1:i,1:n)
259 * H(i) or H(i)**H is applied to C(1:m,1:i)
264 * Apply H(i) or H(i)**H
269 TAUI = CONJG( TAU( I ) )
273 CALL CLARF( SIDE, MI, NI, AP( II-I+1 ), 1, TAUI, C, LDC,
285 * Q was determined by a call to CHPTRD with UPLO = 'L'.
287 FORWRD = ( LEFT .AND. .NOT.NOTRAN ) .OR.
288 $ ( .NOT.LEFT .AND. NOTRAN )
299 II = NQ*( NQ+1 ) / 2 - 1
315 * H(i) or H(i)**H is applied to C(i+1:m,1:n)
321 * H(i) or H(i)**H is applied to C(1:m,i+1:n)
327 * Apply H(i) or H(i)**H
332 TAUI = CONJG( TAU( I ) )
334 CALL CLARF( SIDE, MI, NI, AP( II ), 1, TAUI, C( IC, JC ),