LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE CTZRQF( M, N, A, LDA, TAU, INFO ) 00002 * 00003 * -- LAPACK routine (version 3.3.1) -- 00004 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00005 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00006 * -- April 2011 -- 00007 * 00008 * .. Scalar Arguments .. 00009 INTEGER INFO, LDA, M, N 00010 * .. 00011 * .. Array Arguments .. 00012 COMPLEX A( LDA, * ), TAU( * ) 00013 * .. 00014 * 00015 * Purpose 00016 * ======= 00017 * 00018 * This routine is deprecated and has been replaced by routine CTZRZF. 00019 * 00020 * CTZRQF reduces the M-by-N ( M<=N ) complex upper trapezoidal matrix A 00021 * to upper triangular form by means of unitary transformations. 00022 * 00023 * The upper trapezoidal matrix A is factored as 00024 * 00025 * A = ( R 0 ) * Z, 00026 * 00027 * where Z is an N-by-N unitary matrix and R is an M-by-M upper 00028 * triangular matrix. 00029 * 00030 * Arguments 00031 * ========= 00032 * 00033 * M (input) INTEGER 00034 * The number of rows of the matrix A. M >= 0. 00035 * 00036 * N (input) INTEGER 00037 * The number of columns of the matrix A. N >= M. 00038 * 00039 * A (input/output) COMPLEX array, dimension (LDA,N) 00040 * On entry, the leading M-by-N upper trapezoidal part of the 00041 * array A must contain the matrix to be factorized. 00042 * On exit, the leading M-by-M upper triangular part of A 00043 * contains the upper triangular matrix R, and elements M+1 to 00044 * N of the first M rows of A, with the array TAU, represent the 00045 * unitary matrix Z as a product of M elementary reflectors. 00046 * 00047 * LDA (input) INTEGER 00048 * The leading dimension of the array A. LDA >= max(1,M). 00049 * 00050 * TAU (output) COMPLEX array, dimension (M) 00051 * The scalar factors of the elementary reflectors. 00052 * 00053 * INFO (output) INTEGER 00054 * = 0: successful exit 00055 * < 0: if INFO = -i, the i-th argument had an illegal value 00056 * 00057 * Further Details 00058 * =============== 00059 * 00060 * The factorization is obtained by Householder's method. The kth 00061 * transformation matrix, Z( k ), whose conjugate transpose is used to 00062 * introduce zeros into the (m - k + 1)th row of A, is given in the form 00063 * 00064 * Z( k ) = ( I 0 ), 00065 * ( 0 T( k ) ) 00066 * 00067 * where 00068 * 00069 * T( k ) = I - tau*u( k )*u( k )**H, u( k ) = ( 1 ), 00070 * ( 0 ) 00071 * ( z( k ) ) 00072 * 00073 * tau is a scalar and z( k ) is an ( n - m ) element vector. 00074 * tau and z( k ) are chosen to annihilate the elements of the kth row 00075 * of X. 00076 * 00077 * The scalar tau is returned in the kth element of TAU and the vector 00078 * u( k ) in the kth row of A, such that the elements of z( k ) are 00079 * in a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in 00080 * the upper triangular part of A. 00081 * 00082 * Z is given by 00083 * 00084 * Z = Z( 1 ) * Z( 2 ) * ... * Z( m ). 00085 * 00086 * ===================================================================== 00087 * 00088 * .. Parameters .. 00089 COMPLEX CONE, CZERO 00090 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ), 00091 $ CZERO = ( 0.0E+0, 0.0E+0 ) ) 00092 * .. 00093 * .. Local Scalars .. 00094 INTEGER I, K, M1 00095 COMPLEX ALPHA 00096 * .. 00097 * .. Intrinsic Functions .. 00098 INTRINSIC CONJG, MAX, MIN 00099 * .. 00100 * .. External Subroutines .. 00101 EXTERNAL CAXPY, CCOPY, CGEMV, CGERC, CLACGV, CLARFG, 00102 $ XERBLA 00103 * .. 00104 * .. Executable Statements .. 00105 * 00106 * Test the input parameters. 00107 * 00108 INFO = 0 00109 IF( M.LT.0 ) THEN 00110 INFO = -1 00111 ELSE IF( N.LT.M ) THEN 00112 INFO = -2 00113 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN 00114 INFO = -4 00115 END IF 00116 IF( INFO.NE.0 ) THEN 00117 CALL XERBLA( 'CTZRQF', -INFO ) 00118 RETURN 00119 END IF 00120 * 00121 * Perform the factorization. 00122 * 00123 IF( M.EQ.0 ) 00124 $ RETURN 00125 IF( M.EQ.N ) THEN 00126 DO 10 I = 1, N 00127 TAU( I ) = CZERO 00128 10 CONTINUE 00129 ELSE 00130 M1 = MIN( M+1, N ) 00131 DO 20 K = M, 1, -1 00132 * 00133 * Use a Householder reflection to zero the kth row of A. 00134 * First set up the reflection. 00135 * 00136 A( K, K ) = CONJG( A( K, K ) ) 00137 CALL CLACGV( N-M, A( K, M1 ), LDA ) 00138 ALPHA = A( K, K ) 00139 CALL CLARFG( N-M+1, ALPHA, A( K, M1 ), LDA, TAU( K ) ) 00140 A( K, K ) = ALPHA 00141 TAU( K ) = CONJG( TAU( K ) ) 00142 * 00143 IF( TAU( K ).NE.CZERO .AND. K.GT.1 ) THEN 00144 * 00145 * We now perform the operation A := A*P( k )**H. 00146 * 00147 * Use the first ( k - 1 ) elements of TAU to store a( k ), 00148 * where a( k ) consists of the first ( k - 1 ) elements of 00149 * the kth column of A. Also let B denote the first 00150 * ( k - 1 ) rows of the last ( n - m ) columns of A. 00151 * 00152 CALL CCOPY( K-1, A( 1, K ), 1, TAU, 1 ) 00153 * 00154 * Form w = a( k ) + B*z( k ) in TAU. 00155 * 00156 CALL CGEMV( 'No transpose', K-1, N-M, CONE, A( 1, M1 ), 00157 $ LDA, A( K, M1 ), LDA, CONE, TAU, 1 ) 00158 * 00159 * Now form a( k ) := a( k ) - conjg(tau)*w 00160 * and B := B - conjg(tau)*w*z( k )**H. 00161 * 00162 CALL CAXPY( K-1, -CONJG( TAU( K ) ), TAU, 1, A( 1, K ), 00163 $ 1 ) 00164 CALL CGERC( K-1, N-M, -CONJG( TAU( K ) ), TAU, 1, 00165 $ A( K, M1 ), LDA, A( 1, M1 ), LDA ) 00166 END IF 00167 20 CONTINUE 00168 END IF 00169 * 00170 RETURN 00171 * 00172 * End of CTZRQF 00173 * 00174 END