Debian Codegraph @

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

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