/src/igraph/vendor/lapack/ddot.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 DDOT |
16 | | |
17 | | =========== DOCUMENTATION =========== |
18 | | |
19 | | Online html documentation available at |
20 | | http://www.netlib.org/lapack/explore-html/ |
21 | | |
22 | | Definition: |
23 | | =========== |
24 | | |
25 | | DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) |
26 | | |
27 | | INTEGER INCX,INCY,N |
28 | | DOUBLE PRECISION DX(*),DY(*) |
29 | | |
30 | | |
31 | | > \par Purpose: |
32 | | ============= |
33 | | > |
34 | | > \verbatim |
35 | | > |
36 | | > DDOT forms the dot product of two vectors. |
37 | | > uses unrolled loops for increments equal to one. |
38 | | > \endverbatim |
39 | | |
40 | | Arguments: |
41 | | ========== |
42 | | |
43 | | > \param[in] N |
44 | | > \verbatim |
45 | | > N is INTEGER |
46 | | > number of elements in input vector(s) |
47 | | > \endverbatim |
48 | | > |
49 | | > \param[in] DX |
50 | | > \verbatim |
51 | | > DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) |
52 | | > \endverbatim |
53 | | > |
54 | | > \param[in] INCX |
55 | | > \verbatim |
56 | | > INCX is INTEGER |
57 | | > storage spacing between elements of DX |
58 | | > \endverbatim |
59 | | > |
60 | | > \param[in] DY |
61 | | > \verbatim |
62 | | > DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) ) |
63 | | > \endverbatim |
64 | | > |
65 | | > \param[in] INCY |
66 | | > \verbatim |
67 | | > INCY is INTEGER |
68 | | > storage spacing between elements of DY |
69 | | > \endverbatim |
70 | | |
71 | | Authors: |
72 | | ======== |
73 | | |
74 | | > \author Univ. of Tennessee |
75 | | > \author Univ. of California Berkeley |
76 | | > \author Univ. of Colorado Denver |
77 | | > \author NAG Ltd. |
78 | | |
79 | | > \date November 2017 |
80 | | |
81 | | > \ingroup double_blas_level1 |
82 | | |
83 | | > \par Further Details: |
84 | | ===================== |
85 | | > |
86 | | > \verbatim |
87 | | > |
88 | | > jack dongarra, linpack, 3/11/78. |
89 | | > modified 12/3/93, array(1) declarations changed to array(*) |
90 | | > \endverbatim |
91 | | > |
92 | | ===================================================================== */ |
93 | | doublereal igraphddot_(integer *n, doublereal *dx, integer *incx, doublereal *dy, |
94 | | integer *incy) |
95 | 0 | { |
96 | | /* System generated locals */ |
97 | 0 | integer i__1; |
98 | 0 | doublereal ret_val; |
99 | | |
100 | | /* Local variables */ |
101 | 0 | integer i__, m, ix, iy, mp1; |
102 | 0 | doublereal dtemp; |
103 | | |
104 | | |
105 | | /* -- Reference BLAS level1 routine (version 3.8.0) -- |
106 | | -- Reference BLAS is a software package provided by Univ. of Tennessee, -- |
107 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
108 | | November 2017 |
109 | | |
110 | | |
111 | | ===================================================================== |
112 | | |
113 | | Parameter adjustments */ |
114 | 0 | --dy; |
115 | 0 | --dx; |
116 | | |
117 | | /* Function Body */ |
118 | 0 | ret_val = 0.; |
119 | 0 | dtemp = 0.; |
120 | 0 | if (*n <= 0) { |
121 | 0 | return ret_val; |
122 | 0 | } |
123 | 0 | if (*incx == 1 && *incy == 1) { |
124 | | |
125 | | /* code for both increments equal to 1 |
126 | | |
127 | | |
128 | | clean-up loop */ |
129 | |
|
130 | 0 | m = *n % 5; |
131 | 0 | if (m != 0) { |
132 | 0 | i__1 = m; |
133 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
134 | 0 | dtemp += dx[i__] * dy[i__]; |
135 | 0 | } |
136 | 0 | if (*n < 5) { |
137 | 0 | ret_val = dtemp; |
138 | 0 | return ret_val; |
139 | 0 | } |
140 | 0 | } |
141 | 0 | mp1 = m + 1; |
142 | 0 | i__1 = *n; |
143 | 0 | for (i__ = mp1; i__ <= i__1; i__ += 5) { |
144 | 0 | dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + |
145 | 0 | dx[i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + |
146 | 0 | dx[i__ + 4] * dy[i__ + 4]; |
147 | 0 | } |
148 | 0 | } else { |
149 | | |
150 | | /* code for unequal increments or equal increments |
151 | | not equal to 1 */ |
152 | |
|
153 | 0 | ix = 1; |
154 | 0 | iy = 1; |
155 | 0 | if (*incx < 0) { |
156 | 0 | ix = (-(*n) + 1) * *incx + 1; |
157 | 0 | } |
158 | 0 | if (*incy < 0) { |
159 | 0 | iy = (-(*n) + 1) * *incy + 1; |
160 | 0 | } |
161 | 0 | i__1 = *n; |
162 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
163 | 0 | dtemp += dx[ix] * dy[iy]; |
164 | 0 | ix += *incx; |
165 | 0 | iy += *incy; |
166 | 0 | } |
167 | 0 | } |
168 | 0 | ret_val = dtemp; |
169 | 0 | return ret_val; |
170 | 0 | } /* igraphddot_ */ |
171 | | |