/src/igraph/vendor/lapack/dger.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 DGER |
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 DGER(M,N,ALPHA,X,INCX,Y,INCY,A,LDA) |
26 | | |
27 | | DOUBLE PRECISION ALPHA |
28 | | INTEGER INCX,INCY,LDA,M,N |
29 | | DOUBLE PRECISION A(LDA,*),X(*),Y(*) |
30 | | |
31 | | |
32 | | > \par Purpose: |
33 | | ============= |
34 | | > |
35 | | > \verbatim |
36 | | > |
37 | | > DGER performs the rank 1 operation |
38 | | > |
39 | | > A := alpha*x*y**T + A, |
40 | | > |
41 | | > where alpha is a scalar, x is an m element vector, y is an n element |
42 | | > vector and A is an m by n matrix. |
43 | | > \endverbatim |
44 | | |
45 | | Arguments: |
46 | | ========== |
47 | | |
48 | | > \param[in] M |
49 | | > \verbatim |
50 | | > M is INTEGER |
51 | | > On entry, M specifies the number of rows of the matrix A. |
52 | | > M must be at least zero. |
53 | | > \endverbatim |
54 | | > |
55 | | > \param[in] N |
56 | | > \verbatim |
57 | | > N is INTEGER |
58 | | > On entry, N specifies the number of columns of the matrix A. |
59 | | > N must be at least zero. |
60 | | > \endverbatim |
61 | | > |
62 | | > \param[in] ALPHA |
63 | | > \verbatim |
64 | | > ALPHA is DOUBLE PRECISION. |
65 | | > On entry, ALPHA specifies the scalar alpha. |
66 | | > \endverbatim |
67 | | > |
68 | | > \param[in] X |
69 | | > \verbatim |
70 | | > X is DOUBLE PRECISION array, dimension at least |
71 | | > ( 1 + ( m - 1 )*abs( INCX ) ). |
72 | | > Before entry, the incremented array X must contain the m |
73 | | > element vector x. |
74 | | > \endverbatim |
75 | | > |
76 | | > \param[in] INCX |
77 | | > \verbatim |
78 | | > INCX is INTEGER |
79 | | > On entry, INCX specifies the increment for the elements of |
80 | | > X. INCX must not be zero. |
81 | | > \endverbatim |
82 | | > |
83 | | > \param[in] Y |
84 | | > \verbatim |
85 | | > Y is DOUBLE PRECISION array, dimension at least |
86 | | > ( 1 + ( n - 1 )*abs( INCY ) ). |
87 | | > Before entry, the incremented array Y must contain the n |
88 | | > element vector y. |
89 | | > \endverbatim |
90 | | > |
91 | | > \param[in] INCY |
92 | | > \verbatim |
93 | | > INCY is INTEGER |
94 | | > On entry, INCY specifies the increment for the elements of |
95 | | > Y. INCY must not be zero. |
96 | | > \endverbatim |
97 | | > |
98 | | > \param[in,out] A |
99 | | > \verbatim |
100 | | > A is DOUBLE PRECISION array, dimension ( LDA, N ) |
101 | | > Before entry, the leading m by n part of the array A must |
102 | | > contain the matrix of coefficients. On exit, A is |
103 | | > overwritten by the updated matrix. |
104 | | > \endverbatim |
105 | | > |
106 | | > \param[in] LDA |
107 | | > \verbatim |
108 | | > LDA is INTEGER |
109 | | > On entry, LDA specifies the first dimension of A as declared |
110 | | > in the calling (sub) program. LDA must be at least |
111 | | > max( 1, m ). |
112 | | > \endverbatim |
113 | | |
114 | | Authors: |
115 | | ======== |
116 | | |
117 | | > \author Univ. of Tennessee |
118 | | > \author Univ. of California Berkeley |
119 | | > \author Univ. of Colorado Denver |
120 | | > \author NAG Ltd. |
121 | | |
122 | | > \date December 2016 |
123 | | |
124 | | > \ingroup double_blas_level2 |
125 | | |
126 | | > \par Further Details: |
127 | | ===================== |
128 | | > |
129 | | > \verbatim |
130 | | > |
131 | | > Level 2 Blas routine. |
132 | | > |
133 | | > -- Written on 22-October-1986. |
134 | | > Jack Dongarra, Argonne National Lab. |
135 | | > Jeremy Du Croz, Nag Central Office. |
136 | | > Sven Hammarling, Nag Central Office. |
137 | | > Richard Hanson, Sandia National Labs. |
138 | | > \endverbatim |
139 | | > |
140 | | ===================================================================== |
141 | | Subroutine */ int igraphdger_(integer *m, integer *n, doublereal *alpha, |
142 | | doublereal *x, integer *incx, doublereal *y, integer *incy, |
143 | | doublereal *a, integer *lda) |
144 | 0 | { |
145 | | /* System generated locals */ |
146 | 0 | integer a_dim1, a_offset, i__1, i__2; |
147 | | |
148 | | /* Local variables */ |
149 | 0 | integer i__, j, ix, jy, kx, info; |
150 | 0 | doublereal temp; |
151 | 0 | extern /* Subroutine */ int igraphxerbla_(char *, integer *, ftnlen); |
152 | | |
153 | | |
154 | | /* -- Reference BLAS level2 routine (version 3.7.0) -- |
155 | | -- Reference BLAS is a software package provided by Univ. of Tennessee, -- |
156 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
157 | | December 2016 |
158 | | |
159 | | |
160 | | ===================================================================== |
161 | | |
162 | | |
163 | | Test the input parameters. |
164 | | |
165 | | Parameter adjustments */ |
166 | 0 | --x; |
167 | 0 | --y; |
168 | 0 | a_dim1 = *lda; |
169 | 0 | a_offset = 1 + a_dim1; |
170 | 0 | a -= a_offset; |
171 | | |
172 | | /* Function Body */ |
173 | 0 | info = 0; |
174 | 0 | if (*m < 0) { |
175 | 0 | info = 1; |
176 | 0 | } else if (*n < 0) { |
177 | 0 | info = 2; |
178 | 0 | } else if (*incx == 0) { |
179 | 0 | info = 5; |
180 | 0 | } else if (*incy == 0) { |
181 | 0 | info = 7; |
182 | 0 | } else if (*lda < max(1,*m)) { |
183 | 0 | info = 9; |
184 | 0 | } |
185 | 0 | if (info != 0) { |
186 | 0 | igraphxerbla_("DGER ", &info, (ftnlen)6); |
187 | 0 | return 0; |
188 | 0 | } |
189 | | |
190 | | /* Quick return if possible. */ |
191 | | |
192 | 0 | if (*m == 0 || *n == 0 || *alpha == 0.) { |
193 | 0 | return 0; |
194 | 0 | } |
195 | | |
196 | | /* Start the operations. In this version the elements of A are |
197 | | accessed sequentially with one pass through A. */ |
198 | | |
199 | 0 | if (*incy > 0) { |
200 | 0 | jy = 1; |
201 | 0 | } else { |
202 | 0 | jy = 1 - (*n - 1) * *incy; |
203 | 0 | } |
204 | 0 | if (*incx == 1) { |
205 | 0 | i__1 = *n; |
206 | 0 | for (j = 1; j <= i__1; ++j) { |
207 | 0 | if (y[jy] != 0.) { |
208 | 0 | temp = *alpha * y[jy]; |
209 | 0 | i__2 = *m; |
210 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
211 | 0 | a[i__ + j * a_dim1] += x[i__] * temp; |
212 | | /* L10: */ |
213 | 0 | } |
214 | 0 | } |
215 | 0 | jy += *incy; |
216 | | /* L20: */ |
217 | 0 | } |
218 | 0 | } else { |
219 | 0 | if (*incx > 0) { |
220 | 0 | kx = 1; |
221 | 0 | } else { |
222 | 0 | kx = 1 - (*m - 1) * *incx; |
223 | 0 | } |
224 | 0 | i__1 = *n; |
225 | 0 | for (j = 1; j <= i__1; ++j) { |
226 | 0 | if (y[jy] != 0.) { |
227 | 0 | temp = *alpha * y[jy]; |
228 | 0 | ix = kx; |
229 | 0 | i__2 = *m; |
230 | 0 | for (i__ = 1; i__ <= i__2; ++i__) { |
231 | 0 | a[i__ + j * a_dim1] += x[ix] * temp; |
232 | 0 | ix += *incx; |
233 | | /* L30: */ |
234 | 0 | } |
235 | 0 | } |
236 | 0 | jy += *incy; |
237 | | /* L40: */ |
238 | 0 | } |
239 | 0 | } |
240 | |
|
241 | 0 | return 0; |
242 | | |
243 | | /* End of DGER . */ |
244 | |
|
245 | 0 | } /* igraphdger_ */ |
246 | | |