zla_gbamv.c
Go to the documentation of this file.
00001 /* zla_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 zla_gbamv__(integer *trans, integer *m, integer *n, 
00017         integer *kl, integer *ku, doublereal *alpha, doublecomplex *ab, 
00018         integer *ldab, doublecomplex *x, integer *incx, doublereal *beta, 
00019         doublereal *y, 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, d__2;
00024 
00025     /* Builtin functions */
00026     double d_imag(doublecomplex *), 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 /*     .. */
00153 /*     .. Parameters .. */
00154 /*     .. */
00155 /*     .. Local Scalars .. */
00156 /*     .. */
00157 /*     .. External Subroutines .. */
00158 /*     .. */
00159 /*     .. External Functions .. */
00160 /*     .. */
00161 /*     .. Intrinsic Functions .. */
00162 /*     .. */
00163 /*     .. Statement Functions */
00164 /*     .. */
00165 /*     .. Statement Function Definitions .. */
00166 /*     .. */
00167 /*     .. Executable Statements .. */
00168 
00169 /*     Test the input parameters. */
00170 
00171     /* Parameter adjustments */
00172     ab_dim1 = *ldab;
00173     ab_offset = 1 + ab_dim1;
00174     ab -= ab_offset;
00175     --x;
00176     --y;
00177 
00178     /* Function Body */
00179     info = 0;
00180     if (! (*trans == ilatrans_("N") || *trans == ilatrans_("T") || *trans == ilatrans_("C"))) {
00181         info = 1;
00182     } else if (*m < 0) {
00183         info = 2;
00184     } else if (*n < 0) {
00185         info = 3;
00186     } else if (*kl < 0) {
00187         info = 4;
00188     } else if (*ku < 0) {
00189         info = 5;
00190     } else if (*ldab < *kl + *ku + 1) {
00191         info = 6;
00192     } else if (*incx == 0) {
00193         info = 8;
00194     } else if (*incy == 0) {
00195         info = 11;
00196     }
00197     if (info != 0) {
00198         xerbla_("ZLA_GBAMV ", &info);
00199         return 0;
00200     }
00201 
00202 /*     Quick return if possible. */
00203 
00204     if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) {
00205         return 0;
00206     }
00207 
00208 /*     Set  LENX  and  LENY, the lengths of the vectors x and y, and set */
00209 /*     up the start points in  X  and  Y. */
00210 
00211     if (*trans == ilatrans_("N")) {
00212         lenx = *n;
00213         leny = *m;
00214     } else {
00215         lenx = *m;
00216         leny = *n;
00217     }
00218     if (*incx > 0) {
00219         kx = 1;
00220     } else {
00221         kx = 1 - (lenx - 1) * *incx;
00222     }
00223     if (*incy > 0) {
00224         ky = 1;
00225     } else {
00226         ky = 1 - (leny - 1) * *incy;
00227     }
00228 
00229 /*     Set SAFE1 essentially to be the underflow threshold times the */
00230 /*     number of additions in each row. */
00231 
00232     safe1 = dlamch_("Safe minimum");
00233     safe1 = (*n + 1) * safe1;
00234 
00235 /*     Form  y := alpha*abs(A)*abs(x) + beta*abs(y). */
00236 
00237 /*     The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to */
00238 /*     the inexact flag.  Still doesn't help change the iteration order */
00239 /*     to per-column. */
00240 
00241     kd = *ku + 1;
00242     iy = ky;
00243     if (*incx == 1) {
00244         i__1 = leny;
00245         for (i__ = 1; i__ <= i__1; ++i__) {
00246             if (*beta == 0.) {
00247                 symb_zero__ = TRUE_;
00248                 y[iy] = 0.;
00249             } else if (y[iy] == 0.) {
00250                 symb_zero__ = TRUE_;
00251             } else {
00252                 symb_zero__ = FALSE_;
00253                 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00254             }
00255             if (*alpha != 0.) {
00256 /* Computing MAX */
00257                 i__2 = i__ - *ku;
00258 /* Computing MIN */
00259                 i__4 = i__ + *kl;
00260                 i__3 = min(i__4,lenx);
00261                 for (j = max(i__2,1); j <= i__3; ++j) {
00262                     if (*trans == ilatrans_("N")) {
00263                         i__2 = kd + i__ - j + j * ab_dim1;
00264                         temp = (d__1 = ab[i__2].r, abs(d__1)) + (d__2 = 
00265                                 d_imag(&ab[kd + i__ - j + j * ab_dim1]), abs(
00266                                 d__2));
00267                     } else {
00268                         i__2 = j + (kd + i__ - j) * ab_dim1;
00269                         temp = (d__1 = ab[i__2].r, abs(d__1)) + (d__2 = 
00270                                 d_imag(&ab[j + (kd + i__ - j) * ab_dim1]), 
00271                                 abs(d__2));
00272                     }
00273                     i__2 = j;
00274                     symb_zero__ = symb_zero__ && (x[i__2].r == 0. && x[i__2]
00275                             .i == 0. || temp == 0.);
00276                     i__2 = j;
00277                     y[iy] += *alpha * ((d__1 = x[i__2].r, abs(d__1)) + (d__2 =
00278                              d_imag(&x[j]), abs(d__2))) * temp;
00279                 }
00280             }
00281             if (! symb_zero__) {
00282                 y[iy] += d_sign(&safe1, &y[iy]);
00283             }
00284             iy += *incy;
00285         }
00286     } else {
00287         i__1 = leny;
00288         for (i__ = 1; i__ <= i__1; ++i__) {
00289             if (*beta == 0.) {
00290                 symb_zero__ = TRUE_;
00291                 y[iy] = 0.;
00292             } else if (y[iy] == 0.) {
00293                 symb_zero__ = TRUE_;
00294             } else {
00295                 symb_zero__ = FALSE_;
00296                 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00297             }
00298             if (*alpha != 0.) {
00299                 jx = kx;
00300 /* Computing MAX */
00301                 i__3 = i__ - *ku;
00302 /* Computing MIN */
00303                 i__4 = i__ + *kl;
00304                 i__2 = min(i__4,lenx);
00305                 for (j = max(i__3,1); j <= i__2; ++j) {
00306                     if (*trans == ilatrans_("N")) {
00307                         i__3 = kd + i__ - j + j * ab_dim1;
00308                         temp = (d__1 = ab[i__3].r, abs(d__1)) + (d__2 = 
00309                                 d_imag(&ab[kd + i__ - j + j * ab_dim1]), abs(
00310                                 d__2));
00311                     } else {
00312                         i__3 = j + (kd + i__ - j) * ab_dim1;
00313                         temp = (d__1 = ab[i__3].r, abs(d__1)) + (d__2 = 
00314                                 d_imag(&ab[j + (kd + i__ - j) * ab_dim1]), 
00315                                 abs(d__2));
00316                     }
00317                     i__3 = jx;
00318                     symb_zero__ = symb_zero__ && (x[i__3].r == 0. && x[i__3]
00319                             .i == 0. || temp == 0.);
00320                     i__3 = jx;
00321                     y[iy] += *alpha * ((d__1 = x[i__3].r, abs(d__1)) + (d__2 =
00322                              d_imag(&x[jx]), abs(d__2))) * temp;
00323                     jx += *incx;
00324                 }
00325             }
00326             if (! symb_zero__) {
00327                 y[iy] += d_sign(&safe1, &y[iy]);
00328             }
00329             iy += *incy;
00330         }
00331     }
00332 
00333     return 0;
00334 
00335 /*     End of ZLA_GBAMV */
00336 
00337 } /* zla_gbamv__ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:39