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