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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:29