1 *> \brief \b CUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CUNM2R + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cunm2r.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cunm2r.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cunm2r.f">
21 * SUBROUTINE CUNM2R( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS
26 * INTEGER INFO, K, LDA, LDC, M, N
28 * .. Array Arguments ..
29 * COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
38 *> CUNM2R overwrites the general complex m-by-n matrix C with
40 *> Q * C if SIDE = 'L' and TRANS = 'N', or
42 *> Q**H* C if SIDE = 'L' and TRANS = 'C', or
44 *> C * Q if SIDE = 'R' and TRANS = 'N', or
46 *> C * Q**H if SIDE = 'R' and TRANS = 'C',
48 *> where Q is a complex unitary matrix defined as the product of k
49 *> elementary reflectors
51 *> Q = H(1) H(2) . . . H(k)
53 *> as returned by CGEQRF. Q is of order m if SIDE = 'L' and of order n
62 *> SIDE is CHARACTER*1
63 *> = 'L': apply Q or Q**H from the Left
64 *> = 'R': apply Q or Q**H from the Right
69 *> TRANS is CHARACTER*1
70 *> = 'N': apply Q (No transpose)
71 *> = 'C': apply Q**H (Conjugate transpose)
77 *> The number of rows of the matrix C. M >= 0.
83 *> The number of columns of the matrix C. N >= 0.
89 *> The number of elementary reflectors whose product defines
91 *> If SIDE = 'L', M >= K >= 0;
92 *> if SIDE = 'R', N >= K >= 0.
97 *> A is COMPLEX array, dimension (LDA,K)
98 *> The i-th column must contain the vector which defines the
99 *> elementary reflector H(i), for i = 1,2,...,k, as returned by
100 *> CGEQRF in the first k columns of its array argument A.
101 *> A is modified by the routine but restored on exit.
107 *> The leading dimension of the array A.
108 *> If SIDE = 'L', LDA >= max(1,M);
109 *> if SIDE = 'R', LDA >= max(1,N).
114 *> TAU is COMPLEX array, dimension (K)
115 *> TAU(i) must contain the scalar factor of the elementary
116 *> reflector H(i), as returned by CGEQRF.
121 *> C is COMPLEX array, dimension (LDC,N)
122 *> On entry, the m-by-n matrix C.
123 *> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
129 *> The leading dimension of the array C. LDC >= max(1,M).
134 *> WORK is COMPLEX array, dimension
135 *> (N) if SIDE = 'L',
142 *> = 0: successful exit
143 *> < 0: if INFO = -i, the i-th argument had an illegal value
149 *> \author Univ. of Tennessee
150 *> \author Univ. of California Berkeley
151 *> \author Univ. of Colorado Denver
154 *> \date September 2012
156 *> \ingroup complexOTHERcomputational
158 * =====================================================================
159 SUBROUTINE CUNM2R( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
162 * -- LAPACK computational routine (version 3.4.2) --
163 * -- LAPACK is a software package provided by Univ. of Tennessee, --
164 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
167 * .. Scalar Arguments ..
168 CHARACTER SIDE, TRANS
169 INTEGER INFO, K, LDA, LDC, M, N
171 * .. Array Arguments ..
172 COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
175 * =====================================================================
179 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) )
181 * .. Local Scalars ..
183 INTEGER I, I1, I2, I3, IC, JC, MI, NI, NQ
186 * .. External Functions ..
190 * .. External Subroutines ..
191 EXTERNAL CLARF, XERBLA
193 * .. Intrinsic Functions ..
196 * .. Executable Statements ..
198 * Test the input arguments
201 LEFT = LSAME( SIDE, 'L' )
202 NOTRAN = LSAME( TRANS, 'N' )
204 * NQ is the order of Q
211 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
213 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
215 ELSE IF( M.LT.0 ) THEN
217 ELSE IF( N.LT.0 ) THEN
219 ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN
221 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
223 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
227 CALL XERBLA( 'CUNM2R', -INFO )
231 * Quick return if possible
233 IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 )
236 IF( ( LEFT .AND. .NOT.NOTRAN .OR. .NOT.LEFT .AND. NOTRAN ) ) THEN
257 * H(i) or H(i)**H is applied to C(i:m,1:n)
263 * H(i) or H(i)**H is applied to C(1:m,i:n)
269 * Apply H(i) or H(i)**H
274 TAUI = CONJG( TAU( I ) )
278 CALL CLARF( SIDE, MI, NI, A( I, I ), 1, TAUI, C( IC, JC ), LDC,