Debian Codegraph @

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

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