zla_geamv.c
Go to the documentation of this file.
00001 /* zla_geamv.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_geamv__(integer *trans, integer *m, integer *n, 
00017         doublereal *alpha, doublecomplex *a, integer *lda, doublecomplex *x, 
00018         integer *incx, doublereal *beta, doublereal *y, integer *incy)
00019 {
00020     /* System generated locals */
00021     integer a_dim1, a_offset, i__1, i__2, i__3;
00022     doublereal d__1, d__2;
00023 
00024     /* Builtin functions */
00025     double d_imag(doublecomplex *), d_sign(doublereal *, doublereal *);
00026 
00027     /* Local variables */
00028     extern integer ilatrans_(char *);
00029     integer i__, j;
00030     logical symb_zero__;
00031     integer iy, jx, kx, ky, info;
00032     doublereal temp;
00033     integer lenx, leny;
00034     doublereal safe1;
00035     extern doublereal dlamch_(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 /*  ZLA_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 /*  ALPHA  - DOUBLE PRECISION */
00097 /*           On entry, ALPHA specifies the scalar alpha. */
00098 /*           Unchanged on exit. */
00099 
00100 /*  A      - COMPLEX*16         array of DIMENSION ( LDA, n ) */
00101 /*           Before entry, the leading m by n part of the array A must */
00102 /*           contain the matrix of coefficients. */
00103 /*           Unchanged on exit. */
00104 
00105 /*  LDA    - INTEGER */
00106 /*           On entry, LDA specifies the first dimension of A as declared */
00107 /*           in the calling (sub) program. LDA must be at least */
00108 /*           max( 1, m ). */
00109 /*           Unchanged on exit. */
00110 
00111 /*  X      - COMPLEX*16         array of DIMENSION at least */
00112 /*           ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */
00113 /*           and at least */
00114 /*           ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */
00115 /*           Before entry, the incremented array X must contain the */
00116 /*           vector x. */
00117 /*           Unchanged on exit. */
00118 
00119 /*  INCX   - INTEGER */
00120 /*           On entry, INCX specifies the increment for the elements of */
00121 /*           X. INCX must not be zero. */
00122 /*           Unchanged on exit. */
00123 
00124 /*  BETA   - DOUBLE PRECISION */
00125 /*           On entry, BETA specifies the scalar beta. When BETA is */
00126 /*           supplied as zero then Y need not be set on input. */
00127 /*           Unchanged on exit. */
00128 
00129 /*  Y      - DOUBLE PRECISION   array of DIMENSION at least */
00130 /*           ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */
00131 /*           and at least */
00132 /*           ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */
00133 /*           Before entry with BETA non-zero, the incremented array Y */
00134 /*           must contain the vector y. On exit, Y is overwritten by the */
00135 /*           updated vector y. */
00136 
00137 /*  INCY   - INTEGER */
00138 /*           On entry, INCY specifies the increment for the elements of */
00139 /*           Y. INCY must not be zero. */
00140 /*           Unchanged on exit. */
00141 
00142 
00143 /*  Level 2 Blas routine. */
00144 
00145 /*     .. */
00146 /*     .. Parameters .. */
00147 /*     .. */
00148 /*     .. Local Scalars .. */
00149 /*     .. */
00150 /*     .. External Subroutines .. */
00151 /*     .. */
00152 /*     .. External Functions .. */
00153 /*     .. */
00154 /*     .. Intrinsic Functions .. */
00155 /*     .. */
00156 /*     .. Statement Functions .. */
00157 /*     .. */
00158 /*     .. Statement Function Definitions .. */
00159 /*     .. */
00160 /*     .. Executable Statements .. */
00161 
00162 /*     Test the input parameters. */
00163 
00164     /* Parameter adjustments */
00165     a_dim1 = *lda;
00166     a_offset = 1 + a_dim1;
00167     a -= a_offset;
00168     --x;
00169     --y;
00170 
00171     /* Function Body */
00172     info = 0;
00173     if (! (*trans == ilatrans_("N") || *trans == ilatrans_("T") || *trans == ilatrans_("C"))) {
00174         info = 1;
00175     } else if (*m < 0) {
00176         info = 2;
00177     } else if (*n < 0) {
00178         info = 3;
00179     } else if (*lda < max(1,*m)) {
00180         info = 6;
00181     } else if (*incx == 0) {
00182         info = 8;
00183     } else if (*incy == 0) {
00184         info = 11;
00185     }
00186     if (info != 0) {
00187         xerbla_("ZLA_GEAMV ", &info);
00188         return 0;
00189     }
00190 
00191 /*     Quick return if possible. */
00192 
00193     if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) {
00194         return 0;
00195     }
00196 
00197 /*     Set  LENX  and  LENY, the lengths of the vectors x and y, and set */
00198 /*     up the start points in  X  and  Y. */
00199 
00200     if (*trans == ilatrans_("N")) {
00201         lenx = *n;
00202         leny = *m;
00203     } else {
00204         lenx = *m;
00205         leny = *n;
00206     }
00207     if (*incx > 0) {
00208         kx = 1;
00209     } else {
00210         kx = 1 - (lenx - 1) * *incx;
00211     }
00212     if (*incy > 0) {
00213         ky = 1;
00214     } else {
00215         ky = 1 - (leny - 1) * *incy;
00216     }
00217 
00218 /*     Set SAFE1 essentially to be the underflow threshold times the */
00219 /*     number of additions in each row. */
00220 
00221     safe1 = dlamch_("Safe minimum");
00222     safe1 = (*n + 1) * safe1;
00223 
00224 /*     Form  y := alpha*abs(A)*abs(x) + beta*abs(y). */
00225 
00226 /*     The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to */
00227 /*     the inexact flag.  Still doesn't help change the iteration order */
00228 /*     to per-column. */
00229 
00230     iy = ky;
00231     if (*incx == 1) {
00232         i__1 = leny;
00233         for (i__ = 1; i__ <= i__1; ++i__) {
00234             if (*beta == 0.) {
00235                 symb_zero__ = TRUE_;
00236                 y[iy] = 0.;
00237             } else if (y[iy] == 0.) {
00238                 symb_zero__ = TRUE_;
00239             } else {
00240                 symb_zero__ = FALSE_;
00241                 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00242             }
00243             if (*alpha != 0.) {
00244                 i__2 = lenx;
00245                 for (j = 1; j <= i__2; ++j) {
00246                     if (*trans == ilatrans_("N")) {
00247                         i__3 = i__ + j * a_dim1;
00248                         temp = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(
00249                                 &a[i__ + j * a_dim1]), abs(d__2));
00250                     } else {
00251                         i__3 = j + i__ * a_dim1;
00252                         temp = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(
00253                                 &a[j + i__ * a_dim1]), abs(d__2));
00254                     }
00255                     i__3 = j;
00256                     symb_zero__ = symb_zero__ && (x[i__3].r == 0. && x[i__3]
00257                             .i == 0. || temp == 0.);
00258                     i__3 = j;
00259                     y[iy] += *alpha * ((d__1 = x[i__3].r, abs(d__1)) + (d__2 =
00260                              d_imag(&x[j]), abs(d__2))) * temp;
00261                 }
00262             }
00263             if (! symb_zero__) {
00264                 y[iy] += d_sign(&safe1, &y[iy]);
00265             }
00266             iy += *incy;
00267         }
00268     } else {
00269         i__1 = leny;
00270         for (i__ = 1; i__ <= i__1; ++i__) {
00271             if (*beta == 0.) {
00272                 symb_zero__ = TRUE_;
00273                 y[iy] = 0.;
00274             } else if (y[iy] == 0.) {
00275                 symb_zero__ = TRUE_;
00276             } else {
00277                 symb_zero__ = FALSE_;
00278                 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00279             }
00280             if (*alpha != 0.) {
00281                 jx = kx;
00282                 i__2 = lenx;
00283                 for (j = 1; j <= i__2; ++j) {
00284                     if (*trans == ilatrans_("N")) {
00285                         i__3 = i__ + j * a_dim1;
00286                         temp = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(
00287                                 &a[i__ + j * a_dim1]), abs(d__2));
00288                     } else {
00289                         i__3 = j + i__ * a_dim1;
00290                         temp = (d__1 = a[i__3].r, abs(d__1)) + (d__2 = d_imag(
00291                                 &a[j + i__ * a_dim1]), abs(d__2));
00292                     }
00293                     i__3 = jx;
00294                     symb_zero__ = symb_zero__ && (x[i__3].r == 0. && x[i__3]
00295                             .i == 0. || temp == 0.);
00296                     i__3 = jx;
00297                     y[iy] += *alpha * ((d__1 = x[i__3].r, abs(d__1)) + (d__2 =
00298                              d_imag(&x[jx]), abs(d__2))) * temp;
00299                     jx += *incx;
00300                 }
00301             }
00302             if (! symb_zero__) {
00303                 y[iy] += d_sign(&safe1, &y[iy]);
00304             }
00305             iy += *incy;
00306         }
00307     }
00308 
00309     return 0;
00310 
00311 /*     End of ZLA_GEAMV */
00312 
00313 } /* zla_geamv__ */


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