00001 /* clarz.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Table of constant values */ 00017 00018 static complex c_b1 = {1.f,0.f}; 00019 static integer c__1 = 1; 00020 00021 /* Subroutine */ int clarz_(char *side, integer *m, integer *n, integer *l, 00022 complex *v, integer *incv, complex *tau, complex *c__, integer *ldc, 00023 complex *work) 00024 { 00025 /* System generated locals */ 00026 integer c_dim1, c_offset; 00027 complex q__1; 00028 00029 /* Local variables */ 00030 extern /* Subroutine */ int cgerc_(integer *, integer *, complex *, 00031 complex *, integer *, complex *, integer *, complex *, integer *), 00032 cgemv_(char *, integer *, integer *, complex *, complex *, 00033 integer *, complex *, integer *, complex *, complex *, integer *); 00034 extern logical lsame_(char *, char *); 00035 extern /* Subroutine */ int cgeru_(integer *, integer *, complex *, 00036 complex *, integer *, complex *, integer *, complex *, integer *), 00037 ccopy_(integer *, complex *, integer *, complex *, integer *), 00038 caxpy_(integer *, complex *, complex *, integer *, complex *, 00039 integer *), clacgv_(integer *, complex *, integer *); 00040 00041 00042 /* -- LAPACK routine (version 3.2) -- */ 00043 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00044 /* November 2006 */ 00045 00046 /* .. Scalar Arguments .. */ 00047 /* .. */ 00048 /* .. Array Arguments .. */ 00049 /* .. */ 00050 00051 /* Purpose */ 00052 /* ======= */ 00053 00054 /* CLARZ applies a complex elementary reflector H to a complex */ 00055 /* M-by-N matrix C, from either the left or the right. H is represented */ 00056 /* in the form */ 00057 00058 /* H = I - tau * v * v' */ 00059 00060 /* where tau is a complex scalar and v is a complex vector. */ 00061 00062 /* If tau = 0, then H is taken to be the unit matrix. */ 00063 00064 /* To apply H' (the conjugate transpose of H), supply conjg(tau) instead */ 00065 /* tau. */ 00066 00067 /* H is a product of k elementary reflectors as returned by CTZRZF. */ 00068 00069 /* Arguments */ 00070 /* ========= */ 00071 00072 /* SIDE (input) CHARACTER*1 */ 00073 /* = 'L': form H * C */ 00074 /* = 'R': form C * H */ 00075 00076 /* M (input) INTEGER */ 00077 /* The number of rows of the matrix C. */ 00078 00079 /* N (input) INTEGER */ 00080 /* The number of columns of the matrix C. */ 00081 00082 /* L (input) INTEGER */ 00083 /* The number of entries of the vector V containing */ 00084 /* the meaningful part of the Householder vectors. */ 00085 /* If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */ 00086 00087 /* V (input) COMPLEX array, dimension (1+(L-1)*abs(INCV)) */ 00088 /* The vector v in the representation of H as returned by */ 00089 /* CTZRZF. V is not used if TAU = 0. */ 00090 00091 /* INCV (input) INTEGER */ 00092 /* The increment between elements of v. INCV <> 0. */ 00093 00094 /* TAU (input) COMPLEX */ 00095 /* The value tau in the representation of H. */ 00096 00097 /* C (input/output) COMPLEX array, dimension (LDC,N) */ 00098 /* On entry, the M-by-N matrix C. */ 00099 /* On exit, C is overwritten by the matrix H * C if SIDE = 'L', */ 00100 /* or C * H if SIDE = 'R'. */ 00101 00102 /* LDC (input) INTEGER */ 00103 /* The leading dimension of the array C. LDC >= max(1,M). */ 00104 00105 /* WORK (workspace) COMPLEX array, dimension */ 00106 /* (N) if SIDE = 'L' */ 00107 /* or (M) if SIDE = 'R' */ 00108 00109 /* Further Details */ 00110 /* =============== */ 00111 00112 /* Based on contributions by */ 00113 /* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */ 00114 00115 /* ===================================================================== */ 00116 00117 /* .. Parameters .. */ 00118 /* .. */ 00119 /* .. External Subroutines .. */ 00120 /* .. */ 00121 /* .. External Functions .. */ 00122 /* .. */ 00123 /* .. Executable Statements .. */ 00124 00125 /* Parameter adjustments */ 00126 --v; 00127 c_dim1 = *ldc; 00128 c_offset = 1 + c_dim1; 00129 c__ -= c_offset; 00130 --work; 00131 00132 /* Function Body */ 00133 if (lsame_(side, "L")) { 00134 00135 /* Form H * C */ 00136 00137 if (tau->r != 0.f || tau->i != 0.f) { 00138 00139 /* w( 1:n ) = conjg( C( 1, 1:n ) ) */ 00140 00141 ccopy_(n, &c__[c_offset], ldc, &work[1], &c__1); 00142 clacgv_(n, &work[1], &c__1); 00143 00144 /* w( 1:n ) = conjg( w( 1:n ) + C( m-l+1:m, 1:n )' * v( 1:l ) ) */ 00145 00146 cgemv_("Conjugate transpose", l, n, &c_b1, &c__[*m - *l + 1 + 00147 c_dim1], ldc, &v[1], incv, &c_b1, &work[1], &c__1); 00148 clacgv_(n, &work[1], &c__1); 00149 00150 /* C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n ) */ 00151 00152 q__1.r = -tau->r, q__1.i = -tau->i; 00153 caxpy_(n, &q__1, &work[1], &c__1, &c__[c_offset], ldc); 00154 00155 /* C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ... */ 00156 /* tau * v( 1:l ) * conjg( w( 1:n )' ) */ 00157 00158 q__1.r = -tau->r, q__1.i = -tau->i; 00159 cgeru_(l, n, &q__1, &v[1], incv, &work[1], &c__1, &c__[*m - *l + 00160 1 + c_dim1], ldc); 00161 } 00162 00163 } else { 00164 00165 /* Form C * H */ 00166 00167 if (tau->r != 0.f || tau->i != 0.f) { 00168 00169 /* w( 1:m ) = C( 1:m, 1 ) */ 00170 00171 ccopy_(m, &c__[c_offset], &c__1, &work[1], &c__1); 00172 00173 /* w( 1:m ) = w( 1:m ) + C( 1:m, n-l+1:n, 1:n ) * v( 1:l ) */ 00174 00175 cgemv_("No transpose", m, l, &c_b1, &c__[(*n - *l + 1) * c_dim1 + 00176 1], ldc, &v[1], incv, &c_b1, &work[1], &c__1); 00177 00178 /* C( 1:m, 1 ) = C( 1:m, 1 ) - tau * w( 1:m ) */ 00179 00180 q__1.r = -tau->r, q__1.i = -tau->i; 00181 caxpy_(m, &q__1, &work[1], &c__1, &c__[c_offset], &c__1); 00182 00183 /* C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ... */ 00184 /* tau * w( 1:m ) * v( 1:l )' */ 00185 00186 q__1.r = -tau->r, q__1.i = -tau->i; 00187 cgerc_(m, l, &q__1, &work[1], &c__1, &v[1], incv, &c__[(*n - *l + 00188 1) * c_dim1 + 1], ldc); 00189 00190 } 00191 00192 } 00193 00194 return 0; 00195 00196 /* End of CLARZ */ 00197 00198 } /* clarz_ */