Debian Codegraph @

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

raw
1 /* ./src_f77/ssymv.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 ssymv_(char *uplo, integer *n, real *alpha, real *a,
9 integer *lda, real *x, integer *incx, real *beta, real *y, integer *
10 incy, ftnlen uplo_len)
11 {
12 /* System generated locals */
13 integer a_dim1, a_offset, i__1, i__2;
14
15 /* Local variables */
16 static integer i__, j, ix, iy, jx, jy, kx, ky, info;
17 static real temp1, temp2;
18 extern logical lsame_(char *, char *, ftnlen, ftnlen);
19 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
20
21 /* .. Scalar Arguments .. */
22 /* .. Array Arguments .. */
23 /* .. */
24
25 /* Purpose */
26 /* ======= */
27
28 /* SSYMV performs the matrix-vector operation */
29
30 /* y := alpha*A*x + beta*y, */
31
32 /* where alpha and beta are scalars, x and y are n element vectors and */
33 /* A is an n by n symmetric matrix. */
34
35 /* Parameters */
36 /* ========== */
37
38 /* UPLO - CHARACTER*1. */
39 /* On entry, UPLO specifies whether the upper or lower */
40 /* triangular part of the array A is to be referenced as */
41 /* follows: */
42
43 /* UPLO = 'U' or 'u' Only the upper triangular part of A */
44 /* is to be referenced. */
45
46 /* UPLO = 'L' or 'l' Only the lower triangular part of A */
47 /* is to be referenced. */
48
49 /* Unchanged on exit. */
50
51 /* N - INTEGER. */
52 /* On entry, N specifies the order of the matrix A. */
53 /* N must be at least zero. */
54 /* Unchanged on exit. */
55
56 /* ALPHA - REAL . */
57 /* On entry, ALPHA specifies the scalar alpha. */
58 /* Unchanged on exit. */
59
60 /* A - REAL array of DIMENSION ( LDA, n ). */
61 /* Before entry with UPLO = 'U' or 'u', the leading n by n */
62 /* upper triangular part of the array A must contain the upper */
63 /* triangular part of the symmetric matrix and the strictly */
64 /* lower triangular part of A is not referenced. */
65 /* Before entry with UPLO = 'L' or 'l', the leading n by n */
66 /* lower triangular part of the array A must contain the lower */
67 /* triangular part of the symmetric matrix and the strictly */
68 /* upper triangular part of A is not referenced. */
69 /* Unchanged on exit. */
70
71 /* LDA - INTEGER. */
72 /* On entry, LDA specifies the first dimension of A as declared */
73 /* in the calling (sub) program. LDA must be at least */
74 /* max( 1, n ). */
75 /* Unchanged on exit. */
76
77 /* X - REAL array of dimension at least */
78 /* ( 1 + ( n - 1 )*abs( INCX ) ). */
79 /* Before entry, the incremented array X must contain the n */
80 /* element vector x. */
81 /* Unchanged on exit. */
82
83 /* INCX - INTEGER. */
84 /* On entry, INCX specifies the increment for the elements of */
85 /* X. INCX must not be zero. */
86 /* Unchanged on exit. */
87
88 /* BETA - REAL . */
89 /* On entry, BETA specifies the scalar beta. When BETA is */
90 /* supplied as zero then Y need not be set on input. */
91 /* Unchanged on exit. */
92
93 /* Y - REAL array of dimension at least */
94 /* ( 1 + ( n - 1 )*abs( INCY ) ). */
95 /* Before entry, the incremented array Y must contain the n */
96 /* element vector y. On exit, Y is overwritten by the updated */
97 /* vector y. */
98
99 /* INCY - INTEGER. */
100 /* On entry, INCY specifies the increment for the elements of */
101 /* Y. INCY must not be zero. */
102 /* Unchanged on exit. */
103
104
105 /* Level 2 Blas routine. */
106
107 /* -- Written on 22-October-1986. */
108 /* Jack Dongarra, Argonne National Lab. */
109 /* Jeremy Du Croz, Nag Central Office. */
110 /* Sven Hammarling, Nag Central Office. */
111 /* Richard Hanson, Sandia National Labs. */
112
113
114 /* .. Parameters .. */
115 /* .. Local Scalars .. */
116 /* .. External Functions .. */
117 /* .. External Subroutines .. */
118 /* .. Intrinsic Functions .. */
119 /* .. */
120 /* .. Executable Statements .. */
121
122 /* Test the input parameters. */
123
124 /* Parameter adjustments */
125 a_dim1 = *lda;
126 a_offset = 1 + a_dim1;
127 a -= a_offset;
128 --x;
129 --y;
130
131 /* Function Body */
132 info = 0;
133 if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (
134 ftnlen)1, (ftnlen)1)) {
135 info = 1;
136 } else if (*n < 0) {
137 info = 2;
138 } else if (*lda < max(1,*n)) {
139 info = 5;
140 } else if (*incx == 0) {
141 info = 7;
142 } else if (*incy == 0) {
143 info = 10;
144 }
145 if (info != 0) {
146 xerbla_("SSYMV ", &info, (ftnlen)6);
147 return 0;
148 }
149
150 /* Quick return if possible. */
151
152 if (*n == 0 || *alpha == 0.f && *beta == 1.f) {
153 return 0;
154 }
155
156 /* Set up the start points in X and Y. */
157
158 if (*incx > 0) {
159 kx = 1;
160 } else {
161 kx = 1 - (*n - 1) * *incx;
162 }
163 if (*incy > 0) {
164 ky = 1;
165 } else {
166 ky = 1 - (*n - 1) * *incy;
167 }
168
169 /* Start the operations. In this version the elements of A are */
170 /* accessed sequentially with one pass through the triangular part */
171 /* of A. */
172
173 /* First form y := beta*y. */
174
175 if (*beta != 1.f) {
176 if (*incy == 1) {
177 if (*beta == 0.f) {
178 i__1 = *n;
179 for (i__ = 1; i__ <= i__1; ++i__) {
180 y[i__] = 0.f;
181 /* L10: */
182 }
183 } else {
184 i__1 = *n;
185 for (i__ = 1; i__ <= i__1; ++i__) {
186 y[i__] = *beta * y[i__];
187 /* L20: */
188 }
189 }
190 } else {
191 iy = ky;
192 if (*beta == 0.f) {
193 i__1 = *n;
194 for (i__ = 1; i__ <= i__1; ++i__) {
195 y[iy] = 0.f;
196 iy += *incy;
197 /* L30: */
198 }
199 } else {
200 i__1 = *n;
201 for (i__ = 1; i__ <= i__1; ++i__) {
202 y[iy] = *beta * y[iy];
203 iy += *incy;
204 /* L40: */
205 }
206 }
207 }
208 }
209 if (*alpha == 0.f) {
210 return 0;
211 }
212 if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {
213
214 /* Form y when A is stored in upper triangle. */
215
216 if (*incx == 1 && *incy == 1) {
217 i__1 = *n;
218 for (j = 1; j <= i__1; ++j) {
219 temp1 = *alpha * x[j];
220 temp2 = 0.f;
221 i__2 = j - 1;
222 for (i__ = 1; i__ <= i__2; ++i__) {
223 y[i__] += temp1 * a[i__ + j * a_dim1];
224 temp2 += a[i__ + j * a_dim1] * x[i__];
225 /* L50: */
226 }
227 y[j] = y[j] + temp1 * a[j + j * a_dim1] + *alpha * temp2;
228 /* L60: */
229 }
230 } else {
231 jx = kx;
232 jy = ky;
233 i__1 = *n;
234 for (j = 1; j <= i__1; ++j) {
235 temp1 = *alpha * x[jx];
236 temp2 = 0.f;
237 ix = kx;
238 iy = ky;
239 i__2 = j - 1;
240 for (i__ = 1; i__ <= i__2; ++i__) {
241 y[iy] += temp1 * a[i__ + j * a_dim1];
242 temp2 += a[i__ + j * a_dim1] * x[ix];
243 ix += *incx;
244 iy += *incy;
245 /* L70: */
246 }
247 y[jy] = y[jy] + temp1 * a[j + j * a_dim1] + *alpha * temp2;
248 jx += *incx;
249 jy += *incy;
250 /* L80: */
251 }
252 }
253 } else {
254
255 /* Form y when A is stored in lower triangle. */
256
257 if (*incx == 1 && *incy == 1) {
258 i__1 = *n;
259 for (j = 1; j <= i__1; ++j) {
260 temp1 = *alpha * x[j];
261 temp2 = 0.f;
262 y[j] += temp1 * a[j + j * a_dim1];
263 i__2 = *n;
264 for (i__ = j + 1; i__ <= i__2; ++i__) {
265 y[i__] += temp1 * a[i__ + j * a_dim1];
266 temp2 += a[i__ + j * a_dim1] * x[i__];
267 /* L90: */
268 }
269 y[j] += *alpha * temp2;
270 /* L100: */
271 }
272 } else {
273 jx = kx;
274 jy = ky;
275 i__1 = *n;
276 for (j = 1; j <= i__1; ++j) {
277 temp1 = *alpha * x[jx];
278 temp2 = 0.f;
279 y[jy] += temp1 * a[j + j * a_dim1];
280 ix = jx;
281 iy = jy;
282 i__2 = *n;
283 for (i__ = j + 1; i__ <= i__2; ++i__) {
284 ix += *incx;
285 iy += *incy;
286 y[iy] += temp1 * a[i__ + j * a_dim1];
287 temp2 += a[i__ + j * a_dim1] * x[ix];
288 /* L110: */
289 }
290 y[jy] += *alpha * temp2;
291 jx += *incx;
292 jy += *incy;
293 /* L120: */
294 }
295 }
296 }
297
298 return 0;
299
300 /* End of SSYMV . */
301
302 } /* ssymv_ */
303