LAPACK 3.3.0
|
00001 SUBROUTINE ZLARZT( DIRECT, STOREV, N, K, V, LDV, TAU, T, LDT ) 00002 * 00003 * -- LAPACK routine (version 3.2) -- 00004 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00005 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER DIRECT, STOREV 00010 INTEGER K, LDT, LDV, N 00011 * .. 00012 * .. Array Arguments .. 00013 COMPLEX*16 T( LDT, * ), TAU( * ), V( LDV, * ) 00014 * .. 00015 * 00016 * Purpose 00017 * ======= 00018 * 00019 * ZLARZT forms the triangular factor T of a complex block reflector 00020 * H of order > n, which is defined as a product of k elementary 00021 * reflectors. 00022 * 00023 * If DIRECT = 'F', H = H(1) H(2) . . . H(k) and T is upper triangular; 00024 * 00025 * If DIRECT = 'B', H = H(k) . . . H(2) H(1) and T is lower triangular. 00026 * 00027 * If STOREV = 'C', the vector which defines the elementary reflector 00028 * H(i) is stored in the i-th column of the array V, and 00029 * 00030 * H = I - V * T * V' 00031 * 00032 * If STOREV = 'R', the vector which defines the elementary reflector 00033 * H(i) is stored in the i-th row of the array V, and 00034 * 00035 * H = I - V' * T * V 00036 * 00037 * Currently, only STOREV = 'R' and DIRECT = 'B' are supported. 00038 * 00039 * Arguments 00040 * ========= 00041 * 00042 * DIRECT (input) CHARACTER*1 00043 * Specifies the order in which the elementary reflectors are 00044 * multiplied to form the block reflector: 00045 * = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet) 00046 * = 'B': H = H(k) . . . H(2) H(1) (Backward) 00047 * 00048 * STOREV (input) CHARACTER*1 00049 * Specifies how the vectors which define the elementary 00050 * reflectors are stored (see also Further Details): 00051 * = 'C': columnwise (not supported yet) 00052 * = 'R': rowwise 00053 * 00054 * N (input) INTEGER 00055 * The order of the block reflector H. N >= 0. 00056 * 00057 * K (input) INTEGER 00058 * The order of the triangular factor T (= the number of 00059 * elementary reflectors). K >= 1. 00060 * 00061 * V (input/output) COMPLEX*16 array, dimension 00062 * (LDV,K) if STOREV = 'C' 00063 * (LDV,N) if STOREV = 'R' 00064 * The matrix V. See further details. 00065 * 00066 * LDV (input) INTEGER 00067 * The leading dimension of the array V. 00068 * If STOREV = 'C', LDV >= max(1,N); if STOREV = 'R', LDV >= K. 00069 * 00070 * TAU (input) COMPLEX*16 array, dimension (K) 00071 * TAU(i) must contain the scalar factor of the elementary 00072 * reflector H(i). 00073 * 00074 * T (output) COMPLEX*16 array, dimension (LDT,K) 00075 * The k by k triangular factor T of the block reflector. 00076 * If DIRECT = 'F', T is upper triangular; if DIRECT = 'B', T is 00077 * lower triangular. The rest of the array is not used. 00078 * 00079 * LDT (input) INTEGER 00080 * The leading dimension of the array T. LDT >= K. 00081 * 00082 * Further Details 00083 * =============== 00084 * 00085 * Based on contributions by 00086 * A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA 00087 * 00088 * The shape of the matrix V and the storage of the vectors which define 00089 * the H(i) is best illustrated by the following example with n = 5 and 00090 * k = 3. The elements equal to 1 are not stored; the corresponding 00091 * array elements are modified but restored on exit. The rest of the 00092 * array is not used. 00093 * 00094 * DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': 00095 * 00096 * ______V_____ 00097 * ( v1 v2 v3 ) / \ 00098 * ( v1 v2 v3 ) ( v1 v1 v1 v1 v1 . . . . 1 ) 00099 * V = ( v1 v2 v3 ) ( v2 v2 v2 v2 v2 . . . 1 ) 00100 * ( v1 v2 v3 ) ( v3 v3 v3 v3 v3 . . 1 ) 00101 * ( v1 v2 v3 ) 00102 * . . . 00103 * . . . 00104 * 1 . . 00105 * 1 . 00106 * 1 00107 * 00108 * DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': 00109 * 00110 * ______V_____ 00111 * 1 / \ 00112 * . 1 ( 1 . . . . v1 v1 v1 v1 v1 ) 00113 * . . 1 ( . 1 . . . v2 v2 v2 v2 v2 ) 00114 * . . . ( . . 1 . . v3 v3 v3 v3 v3 ) 00115 * . . . 00116 * ( v1 v2 v3 ) 00117 * ( v1 v2 v3 ) 00118 * V = ( v1 v2 v3 ) 00119 * ( v1 v2 v3 ) 00120 * ( v1 v2 v3 ) 00121 * 00122 * ===================================================================== 00123 * 00124 * .. Parameters .. 00125 COMPLEX*16 ZERO 00126 PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) ) 00127 * .. 00128 * .. Local Scalars .. 00129 INTEGER I, INFO, J 00130 * .. 00131 * .. External Subroutines .. 00132 EXTERNAL XERBLA, ZGEMV, ZLACGV, ZTRMV 00133 * .. 00134 * .. External Functions .. 00135 LOGICAL LSAME 00136 EXTERNAL LSAME 00137 * .. 00138 * .. Executable Statements .. 00139 * 00140 * Check for currently supported options 00141 * 00142 INFO = 0 00143 IF( .NOT.LSAME( DIRECT, 'B' ) ) THEN 00144 INFO = -1 00145 ELSE IF( .NOT.LSAME( STOREV, 'R' ) ) THEN 00146 INFO = -2 00147 END IF 00148 IF( INFO.NE.0 ) THEN 00149 CALL XERBLA( 'ZLARZT', -INFO ) 00150 RETURN 00151 END IF 00152 * 00153 DO 20 I = K, 1, -1 00154 IF( TAU( I ).EQ.ZERO ) THEN 00155 * 00156 * H(i) = I 00157 * 00158 DO 10 J = I, K 00159 T( J, I ) = ZERO 00160 10 CONTINUE 00161 ELSE 00162 * 00163 * general case 00164 * 00165 IF( I.LT.K ) THEN 00166 * 00167 * T(i+1:k,i) = - tau(i) * V(i+1:k,1:n) * V(i,1:n)' 00168 * 00169 CALL ZLACGV( N, V( I, 1 ), LDV ) 00170 CALL ZGEMV( 'No transpose', K-I, N, -TAU( I ), 00171 $ V( I+1, 1 ), LDV, V( I, 1 ), LDV, ZERO, 00172 $ T( I+1, I ), 1 ) 00173 CALL ZLACGV( N, V( I, 1 ), LDV ) 00174 * 00175 * T(i+1:k,i) = T(i+1:k,i+1:k) * T(i+1:k,i) 00176 * 00177 CALL ZTRMV( 'Lower', 'No transpose', 'Non-unit', K-I, 00178 $ T( I+1, I+1 ), LDT, T( I+1, I ), 1 ) 00179 END IF 00180 T( I, I ) = TAU( I ) 00181 END IF 00182 20 CONTINUE 00183 RETURN 00184 * 00185 * End of ZLARZT 00186 * 00187 END