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