00001 /* slarz.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 integer c__1 = 1; 00019 static real c_b5 = 1.f; 00020 00021 /* Subroutine */ int slarz_(char *side, integer *m, integer *n, integer *l, 00022 real *v, integer *incv, real *tau, real *c__, integer *ldc, real * 00023 work) 00024 { 00025 /* System generated locals */ 00026 integer c_dim1, c_offset; 00027 real r__1; 00028 00029 /* Local variables */ 00030 extern /* Subroutine */ int sger_(integer *, integer *, real *, real *, 00031 integer *, real *, integer *, real *, integer *); 00032 extern logical lsame_(char *, char *); 00033 extern /* Subroutine */ int sgemv_(char *, integer *, integer *, real *, 00034 real *, integer *, real *, integer *, real *, real *, integer *), scopy_(integer *, real *, integer *, real *, integer *), 00035 saxpy_(integer *, real *, real *, integer *, real *, integer *); 00036 00037 00038 /* -- LAPACK routine (version 3.2) -- */ 00039 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00040 /* November 2006 */ 00041 00042 /* .. Scalar Arguments .. */ 00043 /* .. */ 00044 /* .. Array Arguments .. */ 00045 /* .. */ 00046 00047 /* Purpose */ 00048 /* ======= */ 00049 00050 /* SLARZ applies a real elementary reflector H to a real M-by-N */ 00051 /* matrix C, from either the left or the right. H is represented in the */ 00052 /* form */ 00053 00054 /* H = I - tau * v * v' */ 00055 00056 /* where tau is a real scalar and v is a real vector. */ 00057 00058 /* If tau = 0, then H is taken to be the unit matrix. */ 00059 00060 00061 /* H is a product of k elementary reflectors as returned by STZRZF. */ 00062 00063 /* Arguments */ 00064 /* ========= */ 00065 00066 /* SIDE (input) CHARACTER*1 */ 00067 /* = 'L': form H * C */ 00068 /* = 'R': form C * H */ 00069 00070 /* M (input) INTEGER */ 00071 /* The number of rows of the matrix C. */ 00072 00073 /* N (input) INTEGER */ 00074 /* The number of columns of the matrix C. */ 00075 00076 /* L (input) INTEGER */ 00077 /* The number of entries of the vector V containing */ 00078 /* the meaningful part of the Householder vectors. */ 00079 /* If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */ 00080 00081 /* V (input) REAL array, dimension (1+(L-1)*abs(INCV)) */ 00082 /* The vector v in the representation of H as returned by */ 00083 /* STZRZF. V is not used if TAU = 0. */ 00084 00085 /* INCV (input) INTEGER */ 00086 /* The increment between elements of v. INCV <> 0. */ 00087 00088 /* TAU (input) REAL */ 00089 /* The value tau in the representation of H. */ 00090 00091 /* C (input/output) REAL array, dimension (LDC,N) */ 00092 /* On entry, the M-by-N matrix C. */ 00093 /* On exit, C is overwritten by the matrix H * C if SIDE = 'L', */ 00094 /* or C * H if SIDE = 'R'. */ 00095 00096 /* LDC (input) INTEGER */ 00097 /* The leading dimension of the array C. LDC >= max(1,M). */ 00098 00099 /* WORK (workspace) REAL array, dimension */ 00100 /* (N) if SIDE = 'L' */ 00101 /* or (M) if SIDE = 'R' */ 00102 00103 /* Further Details */ 00104 /* =============== */ 00105 00106 /* Based on contributions by */ 00107 /* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */ 00108 00109 /* ===================================================================== */ 00110 00111 /* .. Parameters .. */ 00112 /* .. */ 00113 /* .. External Subroutines .. */ 00114 /* .. */ 00115 /* .. External Functions .. */ 00116 /* .. */ 00117 /* .. Executable Statements .. */ 00118 00119 /* Parameter adjustments */ 00120 --v; 00121 c_dim1 = *ldc; 00122 c_offset = 1 + c_dim1; 00123 c__ -= c_offset; 00124 --work; 00125 00126 /* Function Body */ 00127 if (lsame_(side, "L")) { 00128 00129 /* Form H * C */ 00130 00131 if (*tau != 0.f) { 00132 00133 /* w( 1:n ) = C( 1, 1:n ) */ 00134 00135 scopy_(n, &c__[c_offset], ldc, &work[1], &c__1); 00136 00137 /* w( 1:n ) = w( 1:n ) + C( m-l+1:m, 1:n )' * v( 1:l ) */ 00138 00139 sgemv_("Transpose", l, n, &c_b5, &c__[*m - *l + 1 + c_dim1], ldc, 00140 &v[1], incv, &c_b5, &work[1], &c__1); 00141 00142 /* C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n ) */ 00143 00144 r__1 = -(*tau); 00145 saxpy_(n, &r__1, &work[1], &c__1, &c__[c_offset], ldc); 00146 00147 /* C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ... */ 00148 /* tau * v( 1:l ) * w( 1:n )' */ 00149 00150 r__1 = -(*tau); 00151 sger_(l, n, &r__1, &v[1], incv, &work[1], &c__1, &c__[*m - *l + 1 00152 + c_dim1], ldc); 00153 } 00154 00155 } else { 00156 00157 /* Form C * H */ 00158 00159 if (*tau != 0.f) { 00160 00161 /* w( 1:m ) = C( 1:m, 1 ) */ 00162 00163 scopy_(m, &c__[c_offset], &c__1, &work[1], &c__1); 00164 00165 /* w( 1:m ) = w( 1:m ) + C( 1:m, n-l+1:n, 1:n ) * v( 1:l ) */ 00166 00167 sgemv_("No transpose", m, l, &c_b5, &c__[(*n - *l + 1) * c_dim1 + 00168 1], ldc, &v[1], incv, &c_b5, &work[1], &c__1); 00169 00170 /* C( 1:m, 1 ) = C( 1:m, 1 ) - tau * w( 1:m ) */ 00171 00172 r__1 = -(*tau); 00173 saxpy_(m, &r__1, &work[1], &c__1, &c__[c_offset], &c__1); 00174 00175 /* C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ... */ 00176 /* tau * w( 1:m ) * v( 1:l )' */ 00177 00178 r__1 = -(*tau); 00179 sger_(m, l, &r__1, &work[1], &c__1, &v[1], incv, &c__[(*n - *l + 00180 1) * c_dim1 + 1], ldc); 00181 00182 } 00183 00184 } 00185 00186 return 0; 00187 00188 /* End of SLARZ */ 00189 00190 } /* slarz_ */