Chris@202
|
1 /* dger.f -- translated by f2c (version 20061008).
|
Chris@202
|
2 You must link the resulting object file with libf2c:
|
Chris@202
|
3 on Microsoft Windows system, link with libf2c.lib;
|
Chris@202
|
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
|
Chris@202
|
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
|
Chris@202
|
6 -- in that order, at the end of the command line, as in
|
Chris@202
|
7 cc *.o -lf2c -lm
|
Chris@202
|
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
|
Chris@202
|
9
|
Chris@202
|
10 http://www.netlib.org/f2c/libf2c.zip
|
Chris@202
|
11 */
|
Chris@202
|
12
|
Chris@202
|
13 #include "f2c.h"
|
Chris@202
|
14 #include "blaswrap.h"
|
Chris@202
|
15
|
Chris@202
|
16 /* Subroutine */ int dger_(integer *m, integer *n, doublereal *alpha,
|
Chris@202
|
17 doublereal *x, integer *incx, doublereal *y, integer *incy,
|
Chris@202
|
18 doublereal *a, integer *lda)
|
Chris@202
|
19 {
|
Chris@202
|
20 /* System generated locals */
|
Chris@202
|
21 integer a_dim1, a_offset, i__1, i__2;
|
Chris@202
|
22
|
Chris@202
|
23 /* Local variables */
|
Chris@202
|
24 integer i__, j, ix, jy, kx, info;
|
Chris@202
|
25 doublereal temp;
|
Chris@202
|
26 extern /* Subroutine */ int xerbla_(char *, integer *);
|
Chris@202
|
27
|
Chris@202
|
28 /* .. Scalar Arguments .. */
|
Chris@202
|
29 /* .. */
|
Chris@202
|
30 /* .. Array Arguments .. */
|
Chris@202
|
31 /* .. */
|
Chris@202
|
32
|
Chris@202
|
33 /* Purpose */
|
Chris@202
|
34 /* ======= */
|
Chris@202
|
35
|
Chris@202
|
36 /* DGER performs the rank 1 operation */
|
Chris@202
|
37
|
Chris@202
|
38 /* A := alpha*x*y' + A, */
|
Chris@202
|
39
|
Chris@202
|
40 /* where alpha is a scalar, x is an m element vector, y is an n element */
|
Chris@202
|
41 /* vector and A is an m by n matrix. */
|
Chris@202
|
42
|
Chris@202
|
43 /* Arguments */
|
Chris@202
|
44 /* ========== */
|
Chris@202
|
45
|
Chris@202
|
46 /* M - INTEGER. */
|
Chris@202
|
47 /* On entry, M specifies the number of rows of the matrix A. */
|
Chris@202
|
48 /* M must be at least zero. */
|
Chris@202
|
49 /* Unchanged on exit. */
|
Chris@202
|
50
|
Chris@202
|
51 /* N - INTEGER. */
|
Chris@202
|
52 /* On entry, N specifies the number of columns of the matrix A. */
|
Chris@202
|
53 /* N must be at least zero. */
|
Chris@202
|
54 /* Unchanged on exit. */
|
Chris@202
|
55
|
Chris@202
|
56 /* ALPHA - DOUBLE PRECISION. */
|
Chris@202
|
57 /* On entry, ALPHA specifies the scalar alpha. */
|
Chris@202
|
58 /* Unchanged on exit. */
|
Chris@202
|
59
|
Chris@202
|
60 /* X - DOUBLE PRECISION array of dimension at least */
|
Chris@202
|
61 /* ( 1 + ( m - 1 )*abs( INCX ) ). */
|
Chris@202
|
62 /* Before entry, the incremented array X must contain the m */
|
Chris@202
|
63 /* element vector x. */
|
Chris@202
|
64 /* Unchanged on exit. */
|
Chris@202
|
65
|
Chris@202
|
66 /* INCX - INTEGER. */
|
Chris@202
|
67 /* On entry, INCX specifies the increment for the elements of */
|
Chris@202
|
68 /* X. INCX must not be zero. */
|
Chris@202
|
69 /* Unchanged on exit. */
|
Chris@202
|
70
|
Chris@202
|
71 /* Y - DOUBLE PRECISION array of dimension at least */
|
Chris@202
|
72 /* ( 1 + ( n - 1 )*abs( INCY ) ). */
|
Chris@202
|
73 /* Before entry, the incremented array Y must contain the n */
|
Chris@202
|
74 /* element vector y. */
|
Chris@202
|
75 /* Unchanged on exit. */
|
Chris@202
|
76
|
Chris@202
|
77 /* INCY - INTEGER. */
|
Chris@202
|
78 /* On entry, INCY specifies the increment for the elements of */
|
Chris@202
|
79 /* Y. INCY must not be zero. */
|
Chris@202
|
80 /* Unchanged on exit. */
|
Chris@202
|
81
|
Chris@202
|
82 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */
|
Chris@202
|
83 /* Before entry, the leading m by n part of the array A must */
|
Chris@202
|
84 /* contain the matrix of coefficients. On exit, A is */
|
Chris@202
|
85 /* overwritten by the updated matrix. */
|
Chris@202
|
86
|
Chris@202
|
87 /* LDA - INTEGER. */
|
Chris@202
|
88 /* On entry, LDA specifies the first dimension of A as declared */
|
Chris@202
|
89 /* in the calling (sub) program. LDA must be at least */
|
Chris@202
|
90 /* max( 1, m ). */
|
Chris@202
|
91 /* Unchanged on exit. */
|
Chris@202
|
92
|
Chris@202
|
93
|
Chris@202
|
94 /* Level 2 Blas routine. */
|
Chris@202
|
95
|
Chris@202
|
96 /* -- Written on 22-October-1986. */
|
Chris@202
|
97 /* Jack Dongarra, Argonne National Lab. */
|
Chris@202
|
98 /* Jeremy Du Croz, Nag Central Office. */
|
Chris@202
|
99 /* Sven Hammarling, Nag Central Office. */
|
Chris@202
|
100 /* Richard Hanson, Sandia National Labs. */
|
Chris@202
|
101
|
Chris@202
|
102
|
Chris@202
|
103 /* .. Parameters .. */
|
Chris@202
|
104 /* .. */
|
Chris@202
|
105 /* .. Local Scalars .. */
|
Chris@202
|
106 /* .. */
|
Chris@202
|
107 /* .. External Subroutines .. */
|
Chris@202
|
108 /* .. */
|
Chris@202
|
109 /* .. Intrinsic Functions .. */
|
Chris@202
|
110 /* .. */
|
Chris@202
|
111
|
Chris@202
|
112 /* Test the input parameters. */
|
Chris@202
|
113
|
Chris@202
|
114 /* Parameter adjustments */
|
Chris@202
|
115 --x;
|
Chris@202
|
116 --y;
|
Chris@202
|
117 a_dim1 = *lda;
|
Chris@202
|
118 a_offset = 1 + a_dim1;
|
Chris@202
|
119 a -= a_offset;
|
Chris@202
|
120
|
Chris@202
|
121 /* Function Body */
|
Chris@202
|
122 info = 0;
|
Chris@202
|
123 if (*m < 0) {
|
Chris@202
|
124 info = 1;
|
Chris@202
|
125 } else if (*n < 0) {
|
Chris@202
|
126 info = 2;
|
Chris@202
|
127 } else if (*incx == 0) {
|
Chris@202
|
128 info = 5;
|
Chris@202
|
129 } else if (*incy == 0) {
|
Chris@202
|
130 info = 7;
|
Chris@202
|
131 } else if (*lda < max(1,*m)) {
|
Chris@202
|
132 info = 9;
|
Chris@202
|
133 }
|
Chris@202
|
134 if (info != 0) {
|
Chris@202
|
135 xerbla_("DGER ", &info);
|
Chris@202
|
136 return 0;
|
Chris@202
|
137 }
|
Chris@202
|
138
|
Chris@202
|
139 /* Quick return if possible. */
|
Chris@202
|
140
|
Chris@202
|
141 if (*m == 0 || *n == 0 || *alpha == 0.) {
|
Chris@202
|
142 return 0;
|
Chris@202
|
143 }
|
Chris@202
|
144
|
Chris@202
|
145 /* Start the operations. In this version the elements of A are */
|
Chris@202
|
146 /* accessed sequentially with one pass through A. */
|
Chris@202
|
147
|
Chris@202
|
148 if (*incy > 0) {
|
Chris@202
|
149 jy = 1;
|
Chris@202
|
150 } else {
|
Chris@202
|
151 jy = 1 - (*n - 1) * *incy;
|
Chris@202
|
152 }
|
Chris@202
|
153 if (*incx == 1) {
|
Chris@202
|
154 i__1 = *n;
|
Chris@202
|
155 for (j = 1; j <= i__1; ++j) {
|
Chris@202
|
156 if (y[jy] != 0.) {
|
Chris@202
|
157 temp = *alpha * y[jy];
|
Chris@202
|
158 i__2 = *m;
|
Chris@202
|
159 for (i__ = 1; i__ <= i__2; ++i__) {
|
Chris@202
|
160 a[i__ + j * a_dim1] += x[i__] * temp;
|
Chris@202
|
161 /* L10: */
|
Chris@202
|
162 }
|
Chris@202
|
163 }
|
Chris@202
|
164 jy += *incy;
|
Chris@202
|
165 /* L20: */
|
Chris@202
|
166 }
|
Chris@202
|
167 } else {
|
Chris@202
|
168 if (*incx > 0) {
|
Chris@202
|
169 kx = 1;
|
Chris@202
|
170 } else {
|
Chris@202
|
171 kx = 1 - (*m - 1) * *incx;
|
Chris@202
|
172 }
|
Chris@202
|
173 i__1 = *n;
|
Chris@202
|
174 for (j = 1; j <= i__1; ++j) {
|
Chris@202
|
175 if (y[jy] != 0.) {
|
Chris@202
|
176 temp = *alpha * y[jy];
|
Chris@202
|
177 ix = kx;
|
Chris@202
|
178 i__2 = *m;
|
Chris@202
|
179 for (i__ = 1; i__ <= i__2; ++i__) {
|
Chris@202
|
180 a[i__ + j * a_dim1] += x[ix] * temp;
|
Chris@202
|
181 ix += *incx;
|
Chris@202
|
182 /* L30: */
|
Chris@202
|
183 }
|
Chris@202
|
184 }
|
Chris@202
|
185 jy += *incy;
|
Chris@202
|
186 /* L40: */
|
Chris@202
|
187 }
|
Chris@202
|
188 }
|
Chris@202
|
189
|
Chris@202
|
190 return 0;
|
Chris@202
|
191
|
Chris@202
|
192 /* End of DGER . */
|
Chris@202
|
193
|
Chris@202
|
194 } /* dger_ */
|