/src/igraph/vendor/lapack/dgemv.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -- translated by f2c (version 20191129). |
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 | | |
15 | | /* > \brief \b DGEMV |
16 | | |
17 | | =========== DOCUMENTATION =========== |
18 | | |
19 | | Online html documentation available at |
20 | | http://www.netlib.org/lapack/explore-html/ |
21 | | |
22 | | Definition: |
23 | | =========== |
24 | | |
25 | | SUBROUTINE DGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) |
26 | | |
27 | | DOUBLE PRECISION ALPHA,BETA |
28 | | INTEGER INCX,INCY,LDA,M,N |
29 | | CHARACTER TRANS |
30 | | DOUBLE PRECISION A(LDA,*),X(*),Y(*) |
31 | | |
32 | | |
33 | | > \par Purpose: |
34 | | ============= |
35 | | > |
36 | | > \verbatim |
37 | | > |
38 | | > DGEMV performs one of the matrix-vector operations |
39 | | > |
40 | | > y := alpha*A*x + beta*y, or y := alpha*A**T*x + beta*y, |
41 | | > |
42 | | > where alpha and beta are scalars, x and y are vectors and A is an |
43 | | > m by n matrix. |
44 | | > \endverbatim |
45 | | |
46 | | Arguments: |
47 | | ========== |
48 | | |
49 | | > \param[in] TRANS |
50 | | > \verbatim |
51 | | > TRANS is CHARACTER*1 |
52 | | > On entry, TRANS specifies the operation to be performed as |
53 | | > follows: |
54 | | > |
55 | | > TRANS = 'N' or 'n' y := alpha*A*x + beta*y. |
56 | | > |
57 | | > TRANS = 'T' or 't' y := alpha*A**T*x + beta*y. |
58 | | > |
59 | | > TRANS = 'C' or 'c' y := alpha*A**T*x + beta*y. |
60 | | > \endverbatim |
61 | | > |
62 | | > \param[in] M |
63 | | > \verbatim |
64 | | > M is INTEGER |
65 | | > On entry, M specifies the number of rows of the matrix A. |
66 | | > M must be at least zero. |
67 | | > \endverbatim |
68 | | > |
69 | | > \param[in] N |
70 | | > \verbatim |
71 | | > N is INTEGER |
72 | | > On entry, N specifies the number of columns of the matrix A. |
73 | | > N must be at least zero. |
74 | | > \endverbatim |
75 | | > |
76 | | > \param[in] ALPHA |
77 | | > \verbatim |
78 | | > ALPHA is DOUBLE PRECISION. |
79 | | > On entry, ALPHA specifies the scalar alpha. |
80 | | > \endverbatim |
81 | | > |
82 | | > \param[in] A |
83 | | > \verbatim |
84 | | > A is DOUBLE PRECISION array, dimension ( LDA, N ) |
85 | | > Before entry, the leading m by n part of the array A must |
86 | | > contain the matrix of coefficients. |
87 | | > \endverbatim |
88 | | > |
89 | | > \param[in] LDA |
90 | | > \verbatim |
91 | | > LDA is INTEGER |
92 | | > On entry, LDA specifies the first dimension of A as declared |
93 | | > in the calling (sub) program. LDA must be at least |
94 | | > max( 1, m ). |
95 | | > \endverbatim |
96 | | > |
97 | | > \param[in] X |
98 | | > \verbatim |
99 | | > X is DOUBLE PRECISION array, dimension at least |
100 | | > ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' |
101 | | > and at least |
102 | | > ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. |
103 | | > Before entry, the incremented array X must contain the |
104 | | > vector x. |
105 | | > \endverbatim |
106 | | > |
107 | | > \param[in] INCX |
108 | | > \verbatim |
109 | | > INCX is INTEGER |
110 | | > On entry, INCX specifies the increment for the elements of |
111 | | > X. INCX must not be zero. |
112 | | > \endverbatim |
113 | | > |
114 | | > \param[in] BETA |
115 | | > \verbatim |
116 | | > BETA is DOUBLE PRECISION. |
117 | | > On entry, BETA specifies the scalar beta. When BETA is |
118 | | > supplied as zero then Y need not be set on input. |
119 | | > \endverbatim |
120 | | > |
121 | | > \param[in,out] Y |
122 | | > \verbatim |
123 | | > Y is DOUBLE PRECISION array, dimension at least |
124 | | > ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' |
125 | | > and at least |
126 | | > ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. |
127 | | > Before entry with BETA non-zero, the incremented array Y |
128 | | > must contain the vector y. On exit, Y is overwritten by the |
129 | | > updated vector y. |
130 | | > \endverbatim |
131 | | > |
132 | | > \param[in] INCY |
133 | | > \verbatim |
134 | | > INCY is INTEGER |
135 | | > On entry, INCY specifies the increment for the elements of |
136 | | > Y. INCY must not be zero. |
137 | | > \endverbatim |
138 | | |
139 | | Authors: |
140 | | ======== |
141 | | |
142 | | > \author Univ. of Tennessee |
143 | | > \author Univ. of California Berkeley |
144 | | > \author Univ. of Colorado Denver |
145 | | > \author NAG Ltd. |
146 | | |
147 | | > \date December 2016 |
148 | | |
149 | | > \ingroup double_blas_level2 |
150 | | |
151 | | > \par Further Details: |
152 | | ===================== |
153 | | > |
154 | | > \verbatim |
155 | | > |
156 | | > Level 2 Blas routine. |
157 | | > The vector and matrix arguments are not referenced when N = 0, or M = 0 |
158 | | > |
159 | | > -- Written on 22-October-1986. |
160 | | > Jack Dongarra, Argonne National Lab. |
161 | | > Jeremy Du Croz, Nag Central Office. |
162 | | > Sven Hammarling, Nag Central Office. |
163 | | > Richard Hanson, Sandia National Labs. |
164 | | > \endverbatim |
165 | | > |
166 | | ===================================================================== |
167 | | Subroutine */ int igraphdgemv_(char *trans, integer *m, integer *n, doublereal * |
168 | | alpha, doublereal *a, integer *lda, doublereal *x, integer *incx, |
169 | | doublereal *beta, doublereal *y, integer *incy) |
170 | 0 | { |
171 | | /* System generated locals */ |
172 | 0 | integer a_dim1, a_offset, i__1, i__2; |
173 | | |
174 | | /* Local variables */ |
175 | 0 | integer i__, j, ix, iy, jx, jy, kx, ky, info; |
176 | 0 | doublereal temp; |
177 | 0 | integer lenx, leny; |
178 | 0 | extern logical igraphlsame_(char *, char *); |
179 | 0 | extern /* Subroutine */ int igraphxerbla_(char *, integer *, ftnlen); |
180 | | |
181 | | |
182 | | /* -- Reference BLAS level2 routine (version 3.7.0) -- |
183 | | -- Reference BLAS is a software package provided by Univ. of Tennessee, -- |
184 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
185 | | December 2016 |
186 | | |
187 | | |
188 | | ===================================================================== |
189 | | |
190 | | |
191 | | Test the input parameters. |
192 | | |
193 | | Parameter adjustments */ |
194 | 0 | a_dim1 = *lda; |
195 | 0 | a_offset = 1 + a_dim1; |
196 | 0 | a -= a_offset; |
197 | 0 | --x; |
198 | 0 | --y; |
199 | | |
200 | | /* Function Body */ |
201 | 0 | info = 0; |
202 | 0 | if (! igraphlsame_(trans, "N") && ! igraphlsame_(trans, "T") && ! igraphlsame_(trans, "C") |
203 | 0 | ) { |
204 | 0 | info = 1; |
205 | 0 | } else if (*m < 0) { |
206 | 0 | info = 2; |
207 | 0 | } else if (*n < 0) { |
208 | 0 | info = 3; |
209 | 0 | } else if (*lda < max(1,*m)) { |
210 | 0 | info = 6; |
211 | 0 | } else if (*incx == 0) { |
212 | 0 | info = 8; |
213 | 0 | } else if (*incy == 0) { |
214 | 0 | info = 11; |
215 | 0 | } |
216 | 0 | if (info != 0) { |
217 | 0 | igraphxerbla_("DGEMV ", &info, (ftnlen)6); |
218 | 0 | return 0; |
219 | 0 | } |
220 | | |
221 | | /* Quick return if possible. */ |
222 | | |
223 | 0 | if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) { |
224 | 0 | return 0; |
225 | 0 | } |
226 | | |
227 | | /* Set LENX and LENY, the lengths of the vectors x and y, and set |
228 | | up the start points in X and Y. */ |
229 | | |
230 | 0 | if (igraphlsame_(trans, "N")) { |
231 | 0 | lenx = *n; |
232 | 0 | leny = *m; |
233 | 0 | } else { |
234 | 0 | lenx = *m; |
235 | 0 | leny = *n; |
236 | 0 | } |
237 | 0 | if (*incx > 0) { |
238 | 0 | kx = 1; |
239 | 0 | } else { |
240 | 0 | kx = 1 - (lenx - 1) * *incx; |
241 | 0 | } |
242 | 0 | if (*incy > 0) { |
243 | 0 | ky = 1; |
244 | 0 | } else { |
245 | 0 | ky = 1 - (leny - 1) * *incy; |
246 | 0 | } |
247 | | |
248 | | /* Start the operations. In this version the elements of A are |
249 | | accessed sequentially with one pass through A. |
250 | | |
251 | | First form y := beta*y. */ |
252 | |
|
253 | 0 | if (*beta != 1.) { |
254 | 0 | if (*incy == 1) { |
255 | 0 | if (*beta == 0.) { |
256 | 0 | i__1 = leny; |
257 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
258 | 0 | y[i__] = 0.; |
259 | | /* L10: */ |
260 | 0 | } |
261 | 0 | } else { |
262 | 0 | i__1 = leny; |
263 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
264 | 0 | y[i__] = *beta * y[i__]; |
265 | | /* L20: */ |
266 | 0 | } |
267 | 0 | } |
268 | 0 | } else { |
269 | 0 | iy = ky; |
270 | 0 | if (*beta == 0.) { |
271 | 0 | i__1 = leny; |
272 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
273 | 0 | y[iy] = 0.; |
274 | 0 | iy += *incy; |
275 | | /* L30: */ |
276 | 0 | } |
277 | 0 | } else { |
278 | 0 | i__1 = leny; |
279 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
280 | 0 | y[iy] = *beta * y[iy]; |
281 | 0 | iy += *incy; |
282 | | /* L40: */ |
283 | 0 | } |
284 | 0 | } |
285 | 0 | } |
286 | 0 | } |
287 | 0 | if (*alpha == 0.) { |
288 | 0 | return 0; |
289 | 0 | } |
290 | 0 | if (igraphlsame_(trans, "N")) { |
291 | | |
292 | | /* Form y := alpha*A*x + y. */ |
293 | |
|
294 | 0 | jx = kx; |
295 | 0 | if (*incy == 1) { |
296 | 0 | i__1 = *n; |
297 | 0 | for (j = 1; j <= i__1; ++j) { |
298 | 0 | temp = *alpha * x[jx]; |
299 | 0 | i__2 = *m; |
300 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
301 | 0 | y[i__] += temp * a[i__ + j * a_dim1]; |
302 | | /* L50: */ |
303 | 0 | } |
304 | 0 | jx += *incx; |
305 | | /* L60: */ |
306 | 0 | } |
307 | 0 | } else { |
308 | 0 | i__1 = *n; |
309 | 0 | for (j = 1; j <= i__1; ++j) { |
310 | 0 | temp = *alpha * x[jx]; |
311 | 0 | iy = ky; |
312 | 0 | i__2 = *m; |
313 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
314 | 0 | y[iy] += temp * a[i__ + j * a_dim1]; |
315 | 0 | iy += *incy; |
316 | | /* L70: */ |
317 | 0 | } |
318 | 0 | jx += *incx; |
319 | | /* L80: */ |
320 | 0 | } |
321 | 0 | } |
322 | 0 | } else { |
323 | | |
324 | | /* Form y := alpha*A**T*x + y. */ |
325 | |
|
326 | 0 | jy = ky; |
327 | 0 | if (*incx == 1) { |
328 | 0 | i__1 = *n; |
329 | 0 | for (j = 1; j <= i__1; ++j) { |
330 | 0 | temp = 0.; |
331 | 0 | i__2 = *m; |
332 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
333 | 0 | temp += a[i__ + j * a_dim1] * x[i__]; |
334 | | /* L90: */ |
335 | 0 | } |
336 | 0 | y[jy] += *alpha * temp; |
337 | 0 | jy += *incy; |
338 | | /* L100: */ |
339 | 0 | } |
340 | 0 | } else { |
341 | 0 | i__1 = *n; |
342 | 0 | for (j = 1; j <= i__1; ++j) { |
343 | 0 | temp = 0.; |
344 | 0 | ix = kx; |
345 | 0 | i__2 = *m; |
346 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
347 | 0 | temp += a[i__ + j * a_dim1] * x[ix]; |
348 | 0 | ix += *incx; |
349 | | /* L110: */ |
350 | 0 | } |
351 | 0 | y[jy] += *alpha * temp; |
352 | 0 | jy += *incy; |
353 | | /* L120: */ |
354 | 0 | } |
355 | 0 | } |
356 | 0 | } |
357 | |
|
358 | 0 | return 0; |
359 | | |
360 | | /* End of DGEMV . */ |
361 | |
|
362 | 0 | } /* igraphdgemv_ */ |
363 | | |