00001 /* sla_gbamv.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 /* Subroutine */ int sla_gbamv__(integer *trans, integer *m, integer *n, 00017 integer *kl, integer *ku, real *alpha, real *ab, integer *ldab, real * 00018 x, integer *incx, real *beta, real *y, integer *incy) 00019 { 00020 /* System generated locals */ 00021 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4; 00022 real r__1; 00023 00024 /* Builtin functions */ 00025 double r_sign(real *, real *); 00026 00027 /* Local variables */ 00028 extern integer ilatrans_(char *); 00029 integer i__, j; 00030 logical symb_zero__; 00031 integer kd, iy, jx, kx, ky, info; 00032 real temp; 00033 integer lenx, leny; 00034 real safe1; 00035 extern doublereal slamch_(char *); 00036 extern /* Subroutine */ int xerbla_(char *, integer *); 00037 00038 00039 /* -- LAPACK routine (version 3.2) -- */ 00040 /* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */ 00041 /* -- Jason Riedy of Univ. of California Berkeley. -- */ 00042 /* -- November 2008 -- */ 00043 00044 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ 00045 /* -- Univ. of California Berkeley and NAG Ltd. -- */ 00046 00047 /* .. */ 00048 /* .. Scalar Arguments .. */ 00049 /* .. */ 00050 /* .. Array Arguments .. */ 00051 /* .. */ 00052 00053 /* Purpose */ 00054 /* ======= */ 00055 00056 /* SLA_GEAMV performs one of the matrix-vector operations */ 00057 00058 /* y := alpha*abs(A)*abs(x) + beta*abs(y), */ 00059 /* or y := alpha*abs(A)'*abs(x) + beta*abs(y), */ 00060 00061 /* where alpha and beta are scalars, x and y are vectors and A is an */ 00062 /* m by n matrix. */ 00063 00064 /* This function is primarily used in calculating error bounds. */ 00065 /* To protect against underflow during evaluation, components in */ 00066 /* the resulting vector are perturbed away from zero by (N+1) */ 00067 /* times the underflow threshold. To prevent unnecessarily large */ 00068 /* errors for block-structure embedded in general matrices, */ 00069 /* "symbolically" zero components are not perturbed. A zero */ 00070 /* entry is considered "symbolic" if all multiplications involved */ 00071 /* in computing that entry have at least one zero multiplicand. */ 00072 00073 /* Parameters */ 00074 /* ========== */ 00075 00076 /* TRANS - INTEGER */ 00077 /* On entry, TRANS specifies the operation to be performed as */ 00078 /* follows: */ 00079 00080 /* BLAS_NO_TRANS y := alpha*abs(A)*abs(x) + beta*abs(y) */ 00081 /* BLAS_TRANS y := alpha*abs(A')*abs(x) + beta*abs(y) */ 00082 /* BLAS_CONJ_TRANS y := alpha*abs(A')*abs(x) + beta*abs(y) */ 00083 00084 /* Unchanged on exit. */ 00085 00086 /* M - INTEGER */ 00087 /* On entry, M specifies the number of rows of the matrix A. */ 00088 /* M must be at least zero. */ 00089 /* Unchanged on exit. */ 00090 00091 /* N - INTEGER */ 00092 /* On entry, N specifies the number of columns of the matrix A. */ 00093 /* N must be at least zero. */ 00094 /* Unchanged on exit. */ 00095 00096 /* KL - INTEGER */ 00097 /* The number of subdiagonals within the band of A. KL >= 0. */ 00098 00099 /* KU - INTEGER */ 00100 /* The number of superdiagonals within the band of A. KU >= 0. */ 00101 00102 /* ALPHA - REAL */ 00103 /* On entry, ALPHA specifies the scalar alpha. */ 00104 /* Unchanged on exit. */ 00105 00106 /* A - REAL array of DIMENSION ( LDA, n ) */ 00107 /* Before entry, the leading m by n part of the array A must */ 00108 /* contain the matrix of coefficients. */ 00109 /* Unchanged on exit. */ 00110 00111 /* LDA - INTEGER */ 00112 /* On entry, LDA specifies the first dimension of A as declared */ 00113 /* in the calling (sub) program. LDA must be at least */ 00114 /* max( 1, m ). */ 00115 /* Unchanged on exit. */ 00116 00117 /* X - REAL array of DIMENSION at least */ 00118 /* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */ 00119 /* and at least */ 00120 /* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */ 00121 /* Before entry, the incremented array X must contain the */ 00122 /* vector x. */ 00123 /* Unchanged on exit. */ 00124 00125 /* INCX - INTEGER */ 00126 /* On entry, INCX specifies the increment for the elements of */ 00127 /* X. INCX must not be zero. */ 00128 /* Unchanged on exit. */ 00129 00130 /* BETA - REAL */ 00131 /* On entry, BETA specifies the scalar beta. When BETA is */ 00132 /* supplied as zero then Y need not be set on input. */ 00133 /* Unchanged on exit. */ 00134 00135 /* Y - REAL array of DIMENSION at least */ 00136 /* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */ 00137 /* and at least */ 00138 /* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */ 00139 /* Before entry with BETA non-zero, the incremented array Y */ 00140 /* must contain the vector y. On exit, Y is overwritten by the */ 00141 /* updated vector y. */ 00142 00143 /* INCY - INTEGER */ 00144 /* On entry, INCY specifies the increment for the elements of */ 00145 /* Y. INCY must not be zero. */ 00146 /* Unchanged on exit. */ 00147 00148 00149 /* Level 2 Blas routine. */ 00150 /* .. */ 00151 /* .. Parameters .. */ 00152 /* .. */ 00153 /* .. Local Scalars .. */ 00154 /* .. */ 00155 /* .. External Subroutines .. */ 00156 /* .. */ 00157 /* .. External Functions .. */ 00158 /* .. */ 00159 /* .. Intrinsic Functions .. */ 00160 /* .. */ 00161 /* .. Executable Statements .. */ 00162 00163 /* Test the input parameters. */ 00164 00165 /* Parameter adjustments */ 00166 ab_dim1 = *ldab; 00167 ab_offset = 1 + ab_dim1; 00168 ab -= ab_offset; 00169 --x; 00170 --y; 00171 00172 /* Function Body */ 00173 info = 0; 00174 if (! (*trans == ilatrans_("N") || *trans == ilatrans_("T") || *trans == ilatrans_("C"))) { 00175 info = 1; 00176 } else if (*m < 0) { 00177 info = 2; 00178 } else if (*n < 0) { 00179 info = 3; 00180 } else if (*kl < 0) { 00181 info = 4; 00182 } else if (*ku < 0) { 00183 info = 5; 00184 } else if (*ldab < *kl + *ku + 1) { 00185 info = 6; 00186 } else if (*incx == 0) { 00187 info = 8; 00188 } else if (*incy == 0) { 00189 info = 11; 00190 } 00191 if (info != 0) { 00192 xerbla_("SLA_GBAMV ", &info); 00193 return 0; 00194 } 00195 00196 /* Quick return if possible. */ 00197 00198 if (*m == 0 || *n == 0 || *alpha == 0.f && *beta == 1.f) { 00199 return 0; 00200 } 00201 00202 /* Set LENX and LENY, the lengths of the vectors x and y, and set */ 00203 /* up the start points in X and Y. */ 00204 00205 if (*trans == ilatrans_("N")) { 00206 lenx = *n; 00207 leny = *m; 00208 } else { 00209 lenx = *m; 00210 leny = *n; 00211 } 00212 if (*incx > 0) { 00213 kx = 1; 00214 } else { 00215 kx = 1 - (lenx - 1) * *incx; 00216 } 00217 if (*incy > 0) { 00218 ky = 1; 00219 } else { 00220 ky = 1 - (leny - 1) * *incy; 00221 } 00222 00223 /* Set SAFE1 essentially to be the underflow threshold times the */ 00224 /* number of additions in each row. */ 00225 00226 safe1 = slamch_("Safe minimum"); 00227 safe1 = (*n + 1) * safe1; 00228 00229 /* Form y := alpha*abs(A)*abs(x) + beta*abs(y). */ 00230 00231 /* The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to */ 00232 /* the inexact flag. Still doesn't help change the iteration order */ 00233 /* to per-column. */ 00234 00235 kd = *ku + 1; 00236 iy = ky; 00237 if (*incx == 1) { 00238 i__1 = leny; 00239 for (i__ = 1; i__ <= i__1; ++i__) { 00240 if (*beta == 0.f) { 00241 symb_zero__ = TRUE_; 00242 y[iy] = 0.f; 00243 } else if (y[iy] == 0.f) { 00244 symb_zero__ = TRUE_; 00245 } else { 00246 symb_zero__ = FALSE_; 00247 y[iy] = *beta * (r__1 = y[iy], dabs(r__1)); 00248 } 00249 if (*alpha != 0.f) { 00250 /* Computing MAX */ 00251 i__2 = i__ - *ku; 00252 /* Computing MIN */ 00253 i__4 = i__ + *kl; 00254 i__3 = min(i__4,lenx); 00255 for (j = max(i__2,1); j <= i__3; ++j) { 00256 if (*trans == ilatrans_("N")) { 00257 temp = (r__1 = ab[kd + i__ - j + j * ab_dim1], dabs( 00258 r__1)); 00259 } else { 00260 temp = (r__1 = ab[j + (kd + i__ - j) * ab_dim1], dabs( 00261 r__1)); 00262 } 00263 symb_zero__ = symb_zero__ && (x[j] == 0.f || temp == 0.f); 00264 y[iy] += *alpha * (r__1 = x[j], dabs(r__1)) * temp; 00265 } 00266 } 00267 if (! symb_zero__) { 00268 y[iy] += r_sign(&safe1, &y[iy]); 00269 } 00270 iy += *incy; 00271 } 00272 } else { 00273 i__1 = leny; 00274 for (i__ = 1; i__ <= i__1; ++i__) { 00275 if (*beta == 0.f) { 00276 symb_zero__ = TRUE_; 00277 y[iy] = 0.f; 00278 } else if (y[iy] == 0.f) { 00279 symb_zero__ = TRUE_; 00280 } else { 00281 symb_zero__ = FALSE_; 00282 y[iy] = *beta * (r__1 = y[iy], dabs(r__1)); 00283 } 00284 if (*alpha != 0.f) { 00285 jx = kx; 00286 /* Computing MAX */ 00287 i__3 = i__ - *ku; 00288 /* Computing MIN */ 00289 i__4 = i__ + *kl; 00290 i__2 = min(i__4,lenx); 00291 for (j = max(i__3,1); j <= i__2; ++j) { 00292 if (*trans == ilatrans_("N")) { 00293 temp = (r__1 = ab[kd + i__ - j + j * ab_dim1], dabs( 00294 r__1)); 00295 } else { 00296 temp = (r__1 = ab[j + (kd + i__ - j) * ab_dim1], dabs( 00297 r__1)); 00298 } 00299 symb_zero__ = symb_zero__ && (x[jx] == 0.f || temp == 0.f) 00300 ; 00301 y[iy] += *alpha * (r__1 = x[jx], dabs(r__1)) * temp; 00302 jx += *incx; 00303 } 00304 } 00305 if (! symb_zero__) { 00306 y[iy] += r_sign(&safe1, &y[iy]); 00307 } 00308 iy += *incy; 00309 } 00310 } 00311 00312 return 0; 00313 00314 /* End of SLA_GBAMV */ 00315 00316 } /* sla_gbamv__ */