Debian Codegraph @

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

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