Debian Codegraph @

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

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