Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/zgerc.c

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