LAPACK 3.3.0
|
00001 SUBROUTINE ZUNMR3( SIDE, TRANS, M, N, K, L, A, LDA, TAU, C, LDC, 00002 $ WORK, INFO ) 00003 * 00004 * -- LAPACK routine (version 3.2) -- 00005 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00006 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00007 * November 2006 00008 * 00009 * .. Scalar Arguments .. 00010 CHARACTER SIDE, TRANS 00011 INTEGER INFO, K, L, LDA, LDC, M, N 00012 * .. 00013 * .. Array Arguments .. 00014 COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * ) 00015 * .. 00016 * 00017 * Purpose 00018 * ======= 00019 * 00020 * ZUNMR3 overwrites the general complex m by n matrix C with 00021 * 00022 * Q * C if SIDE = 'L' and TRANS = 'N', or 00023 * 00024 * Q'* C if SIDE = 'L' and TRANS = 'C', or 00025 * 00026 * C * Q if SIDE = 'R' and TRANS = 'N', or 00027 * 00028 * C * Q' if SIDE = 'R' and TRANS = 'C', 00029 * 00030 * where Q is a complex unitary matrix defined as the product of k 00031 * elementary reflectors 00032 * 00033 * Q = H(1) H(2) . . . H(k) 00034 * 00035 * as returned by ZTZRZF. Q is of order m if SIDE = 'L' and of order n 00036 * if SIDE = 'R'. 00037 * 00038 * Arguments 00039 * ========= 00040 * 00041 * SIDE (input) CHARACTER*1 00042 * = 'L': apply Q or Q' from the Left 00043 * = 'R': apply Q or Q' from the Right 00044 * 00045 * TRANS (input) CHARACTER*1 00046 * = 'N': apply Q (No transpose) 00047 * = 'C': apply Q' (Conjugate transpose) 00048 * 00049 * M (input) INTEGER 00050 * The number of rows of the matrix C. M >= 0. 00051 * 00052 * N (input) INTEGER 00053 * The number of columns of the matrix C. N >= 0. 00054 * 00055 * K (input) INTEGER 00056 * The number of elementary reflectors whose product defines 00057 * the matrix Q. 00058 * If SIDE = 'L', M >= K >= 0; 00059 * if SIDE = 'R', N >= K >= 0. 00060 * 00061 * L (input) INTEGER 00062 * The number of columns of the matrix A containing 00063 * the meaningful part of the Householder reflectors. 00064 * If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. 00065 * 00066 * A (input) COMPLEX*16 array, dimension 00067 * (LDA,M) if SIDE = 'L', 00068 * (LDA,N) if SIDE = 'R' 00069 * The i-th row must contain the vector which defines the 00070 * elementary reflector H(i), for i = 1,2,...,k, as returned by 00071 * ZTZRZF in the last k rows of its array argument A. 00072 * A is modified by the routine but restored on exit. 00073 * 00074 * LDA (input) INTEGER 00075 * The leading dimension of the array A. LDA >= max(1,K). 00076 * 00077 * TAU (input) COMPLEX*16 array, dimension (K) 00078 * TAU(i) must contain the scalar factor of the elementary 00079 * reflector H(i), as returned by ZTZRZF. 00080 * 00081 * C (input/output) COMPLEX*16 array, dimension (LDC,N) 00082 * On entry, the m-by-n matrix C. 00083 * On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. 00084 * 00085 * LDC (input) INTEGER 00086 * The leading dimension of the array C. LDC >= max(1,M). 00087 * 00088 * WORK (workspace) COMPLEX*16 array, dimension 00089 * (N) if SIDE = 'L', 00090 * (M) if SIDE = 'R' 00091 * 00092 * INFO (output) INTEGER 00093 * = 0: successful exit 00094 * < 0: if INFO = -i, the i-th argument had an illegal value 00095 * 00096 * Further Details 00097 * =============== 00098 * 00099 * Based on contributions by 00100 * A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA 00101 * 00102 * ===================================================================== 00103 * 00104 * .. Local Scalars .. 00105 LOGICAL LEFT, NOTRAN 00106 INTEGER I, I1, I2, I3, IC, JA, JC, MI, NI, NQ 00107 COMPLEX*16 TAUI 00108 * .. 00109 * .. External Functions .. 00110 LOGICAL LSAME 00111 EXTERNAL LSAME 00112 * .. 00113 * .. External Subroutines .. 00114 EXTERNAL XERBLA, ZLARZ 00115 * .. 00116 * .. Intrinsic Functions .. 00117 INTRINSIC DCONJG, MAX 00118 * .. 00119 * .. Executable Statements .. 00120 * 00121 * Test the input arguments 00122 * 00123 INFO = 0 00124 LEFT = LSAME( SIDE, 'L' ) 00125 NOTRAN = LSAME( TRANS, 'N' ) 00126 * 00127 * NQ is the order of Q 00128 * 00129 IF( LEFT ) THEN 00130 NQ = M 00131 ELSE 00132 NQ = N 00133 END IF 00134 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN 00135 INFO = -1 00136 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN 00137 INFO = -2 00138 ELSE IF( M.LT.0 ) THEN 00139 INFO = -3 00140 ELSE IF( N.LT.0 ) THEN 00141 INFO = -4 00142 ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN 00143 INFO = -5 00144 ELSE IF( L.LT.0 .OR. ( LEFT .AND. ( L.GT.M ) ) .OR. 00145 $ ( .NOT.LEFT .AND. ( L.GT.N ) ) ) THEN 00146 INFO = -6 00147 ELSE IF( LDA.LT.MAX( 1, K ) ) THEN 00148 INFO = -8 00149 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN 00150 INFO = -11 00151 END IF 00152 IF( INFO.NE.0 ) THEN 00153 CALL XERBLA( 'ZUNMR3', -INFO ) 00154 RETURN 00155 END IF 00156 * 00157 * Quick return if possible 00158 * 00159 IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 ) 00160 $ RETURN 00161 * 00162 IF( ( LEFT .AND. .NOT.NOTRAN .OR. .NOT.LEFT .AND. NOTRAN ) ) THEN 00163 I1 = 1 00164 I2 = K 00165 I3 = 1 00166 ELSE 00167 I1 = K 00168 I2 = 1 00169 I3 = -1 00170 END IF 00171 * 00172 IF( LEFT ) THEN 00173 NI = N 00174 JA = M - L + 1 00175 JC = 1 00176 ELSE 00177 MI = M 00178 JA = N - L + 1 00179 IC = 1 00180 END IF 00181 * 00182 DO 10 I = I1, I2, I3 00183 IF( LEFT ) THEN 00184 * 00185 * H(i) or H(i)' is applied to C(i:m,1:n) 00186 * 00187 MI = M - I + 1 00188 IC = I 00189 ELSE 00190 * 00191 * H(i) or H(i)' is applied to C(1:m,i:n) 00192 * 00193 NI = N - I + 1 00194 JC = I 00195 END IF 00196 * 00197 * Apply H(i) or H(i)' 00198 * 00199 IF( NOTRAN ) THEN 00200 TAUI = TAU( I ) 00201 ELSE 00202 TAUI = DCONJG( TAU( I ) ) 00203 END IF 00204 CALL ZLARZ( SIDE, MI, NI, L, A( I, JA ), LDA, TAUI, 00205 $ C( IC, JC ), LDC, WORK ) 00206 * 00207 10 CONTINUE 00208 * 00209 RETURN 00210 * 00211 * End of ZUNMR3 00212 * 00213 END