Debian Codegraph @

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

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