| 1 |
/* ./src_f77/zgeru.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Subroutine */ int zgeru_(integer *m, integer *n, doublecomplex *alpha, |
| 9 |
doublecomplex *x, integer *incx, doublecomplex *y, integer *incy, |
| 10 |
doublecomplex *a, integer *lda) |
| 11 |
{ |
| 12 |
/* System generated locals */ |
| 13 |
integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5; |
| 14 |
doublecomplex z__1, z__2; |
| 15 |
|
| 16 |
/* Local variables */ |
| 17 |
static integer i__, j, ix, jy, kx, info; |
| 18 |
static doublecomplex temp; |
| 19 |
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen); |
| 20 |
|
| 21 |
/* .. Scalar Arguments .. */ |
| 22 |
/* .. Array Arguments .. */ |
| 23 |
/* .. */ |
| 24 |
|
| 25 |
/* Purpose */ |
| 26 |
/* ======= */ |
| 27 |
|
| 28 |
/* ZGERU performs the rank 1 operation */ |
| 29 |
|
| 30 |
/* A := alpha*x*y' + A, */ |
| 31 |
|
| 32 |
/* where alpha is a scalar, x is an m element vector, y is an n element */ |
| 33 |
/* vector and A is an m by n matrix. */ |
| 34 |
|
| 35 |
/* Parameters */ |
| 36 |
/* ========== */ |
| 37 |
|
| 38 |
/* M - INTEGER. */ |
| 39 |
/* On entry, M specifies the number of rows of the matrix A. */ |
| 40 |
/* M must be at least zero. */ |
| 41 |
/* Unchanged on exit. */ |
| 42 |
|
| 43 |
/* N - INTEGER. */ |
| 44 |
/* On entry, N specifies the number of columns of the matrix A. */ |
| 45 |
/* N must be at least zero. */ |
| 46 |
/* Unchanged on exit. */ |
| 47 |
|
| 48 |
/* ALPHA - COMPLEX*16 . */ |
| 49 |
/* On entry, ALPHA specifies the scalar alpha. */ |
| 50 |
/* Unchanged on exit. */ |
| 51 |
|
| 52 |
/* X - COMPLEX*16 array of dimension at least */ |
| 53 |
/* ( 1 + ( m - 1 )*abs( INCX ) ). */ |
| 54 |
/* Before entry, the incremented array X must contain the m */ |
| 55 |
/* element vector x. */ |
| 56 |
/* Unchanged on exit. */ |
| 57 |
|
| 58 |
/* INCX - INTEGER. */ |
| 59 |
/* On entry, INCX specifies the increment for the elements of */ |
| 60 |
/* X. INCX must not be zero. */ |
| 61 |
/* Unchanged on exit. */ |
| 62 |
|
| 63 |
/* Y - COMPLEX*16 array of dimension at least */ |
| 64 |
/* ( 1 + ( n - 1 )*abs( INCY ) ). */ |
| 65 |
/* Before entry, the incremented array Y must contain the n */ |
| 66 |
/* element vector y. */ |
| 67 |
/* Unchanged on exit. */ |
| 68 |
|
| 69 |
/* INCY - INTEGER. */ |
| 70 |
/* On entry, INCY specifies the increment for the elements of */ |
| 71 |
/* Y. INCY must not be zero. */ |
| 72 |
/* Unchanged on exit. */ |
| 73 |
|
| 74 |
/* A - COMPLEX*16 array of DIMENSION ( LDA, n ). */ |
| 75 |
/* Before entry, the leading m by n part of the array A must */ |
| 76 |
/* contain the matrix of coefficients. On exit, A is */ |
| 77 |
/* overwritten by the updated matrix. */ |
| 78 |
|
| 79 |
/* LDA - INTEGER. */ |
| 80 |
/* On entry, LDA specifies the first dimension of A as declared */ |
| 81 |
/* in the calling (sub) program. LDA must be at least */ |
| 82 |
/* max( 1, m ). */ |
| 83 |
/* Unchanged on exit. */ |
| 84 |
|
| 85 |
|
| 86 |
/* Level 2 Blas routine. */ |
| 87 |
|
| 88 |
/* -- Written on 22-October-1986. */ |
| 89 |
/* Jack Dongarra, Argonne National Lab. */ |
| 90 |
/* Jeremy Du Croz, Nag Central Office. */ |
| 91 |
/* Sven Hammarling, Nag Central Office. */ |
| 92 |
/* Richard Hanson, Sandia National Labs. */ |
| 93 |
|
| 94 |
|
| 95 |
/* .. Parameters .. */ |
| 96 |
/* .. Local Scalars .. */ |
| 97 |
/* .. External Subroutines .. */ |
| 98 |
/* .. Intrinsic Functions .. */ |
| 99 |
/* .. */ |
| 100 |
/* .. Executable Statements .. */ |
| 101 |
|
| 102 |
/* Test the input parameters. */ |
| 103 |
|
| 104 |
/* Parameter adjustments */ |
| 105 |
--x; |
| 106 |
--y; |
| 107 |
a_dim1 = *lda; |
| 108 |
a_offset = 1 + a_dim1; |
| 109 |
a -= a_offset; |
| 110 |
|
| 111 |
/* Function Body */ |
| 112 |
info = 0; |
| 113 |
if (*m < 0) { |
| 114 |
info = 1; |
| 115 |
} else if (*n < 0) { |
| 116 |
info = 2; |
| 117 |
} else if (*incx == 0) { |
| 118 |
info = 5; |
| 119 |
} else if (*incy == 0) { |
| 120 |
info = 7; |
| 121 |
} else if (*lda < max(1,*m)) { |
| 122 |
info = 9; |
| 123 |
} |
| 124 |
if (info != 0) { |
| 125 |
xerbla_("ZGERU ", &info, (ftnlen)6); |
| 126 |
return 0; |
| 127 |
} |
| 128 |
|
| 129 |
/* Quick return if possible. */ |
| 130 |
|
| 131 |
if (*m == 0 || *n == 0 || alpha->r == 0. && alpha->i == 0.) { |
| 132 |
return 0; |
| 133 |
} |
| 134 |
|
| 135 |
/* Start the operations. In this version the elements of A are */ |
| 136 |
/* accessed sequentially with one pass through A. */ |
| 137 |
|
| 138 |
if (*incy > 0) { |
| 139 |
jy = 1; |
| 140 |
} else { |
| 141 |
jy = 1 - (*n - 1) * *incy; |
| 142 |
} |
| 143 |
if (*incx == 1) { |
| 144 |
i__1 = *n; |
| 145 |
for (j = 1; j <= i__1; ++j) { |
| 146 |
i__2 = jy; |
| 147 |
if (y[i__2].r != 0. || y[i__2].i != 0.) { |
| 148 |
i__2 = jy; |
| 149 |
z__1.r = alpha->r * y[i__2].r - alpha->i * y[i__2].i, z__1.i = |
| 150 |
alpha->r * y[i__2].i + alpha->i * y[i__2].r; |
| 151 |
temp.r = z__1.r, temp.i = z__1.i; |
| 152 |
i__2 = *m; |
| 153 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 154 |
i__3 = i__ + j * a_dim1; |
| 155 |
i__4 = i__ + j * a_dim1; |
| 156 |
i__5 = i__; |
| 157 |
z__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, z__2.i = |
| 158 |
x[i__5].r * temp.i + x[i__5].i * temp.r; |
| 159 |
z__1.r = a[i__4].r + z__2.r, z__1.i = a[i__4].i + z__2.i; |
| 160 |
a[i__3].r = z__1.r, a[i__3].i = z__1.i; |
| 161 |
/* L10: */ |
| 162 |
} |
| 163 |
} |
| 164 |
jy += *incy; |
| 165 |
/* L20: */ |
| 166 |
} |
| 167 |
} else { |
| 168 |
if (*incx > 0) { |
| 169 |
kx = 1; |
| 170 |
} else { |
| 171 |
kx = 1 - (*m - 1) * *incx; |
| 172 |
} |
| 173 |
i__1 = *n; |
| 174 |
for (j = 1; j <= i__1; ++j) { |
| 175 |
i__2 = jy; |
| 176 |
if (y[i__2].r != 0. || y[i__2].i != 0.) { |
| 177 |
i__2 = jy; |
| 178 |
z__1.r = alpha->r * y[i__2].r - alpha->i * y[i__2].i, z__1.i = |
| 179 |
alpha->r * y[i__2].i + alpha->i * y[i__2].r; |
| 180 |
temp.r = z__1.r, temp.i = z__1.i; |
| 181 |
ix = kx; |
| 182 |
i__2 = *m; |
| 183 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 184 |
i__3 = i__ + j * a_dim1; |
| 185 |
i__4 = i__ + j * a_dim1; |
| 186 |
i__5 = ix; |
| 187 |
z__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, z__2.i = |
| 188 |
x[i__5].r * temp.i + x[i__5].i * temp.r; |
| 189 |
z__1.r = a[i__4].r + z__2.r, z__1.i = a[i__4].i + z__2.i; |
| 190 |
a[i__3].r = z__1.r, a[i__3].i = z__1.i; |
| 191 |
ix += *incx; |
| 192 |
/* L30: */ |
| 193 |
} |
| 194 |
} |
| 195 |
jy += *incy; |
| 196 |
/* L40: */ |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
return 0; |
| 201 |
|
| 202 |
/* End of ZGERU . */ |
| 203 |
|
| 204 |
} /* zgeru_ */ |
| 205 |
|