/src/igraph/vendor/lapack/dasum.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 DASUM |
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 DASUM(N,DX,INCX) |
26 | | |
27 | | INTEGER INCX,N |
28 | | DOUBLE PRECISION DX(*) |
29 | | |
30 | | |
31 | | > \par Purpose: |
32 | | ============= |
33 | | > |
34 | | > \verbatim |
35 | | > |
36 | | > DASUM takes the sum of the absolute values. |
37 | | > \endverbatim |
38 | | |
39 | | Arguments: |
40 | | ========== |
41 | | |
42 | | > \param[in] N |
43 | | > \verbatim |
44 | | > N is INTEGER |
45 | | > number of elements in input vector(s) |
46 | | > \endverbatim |
47 | | > |
48 | | > \param[in] DX |
49 | | > \verbatim |
50 | | > DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) |
51 | | > \endverbatim |
52 | | > |
53 | | > \param[in] INCX |
54 | | > \verbatim |
55 | | > INCX is INTEGER |
56 | | > storage spacing between elements of DX |
57 | | > \endverbatim |
58 | | |
59 | | Authors: |
60 | | ======== |
61 | | |
62 | | > \author Univ. of Tennessee |
63 | | > \author Univ. of California Berkeley |
64 | | > \author Univ. of Colorado Denver |
65 | | > \author NAG Ltd. |
66 | | |
67 | | > \date November 2017 |
68 | | |
69 | | > \ingroup double_blas_level1 |
70 | | |
71 | | > \par Further Details: |
72 | | ===================== |
73 | | > |
74 | | > \verbatim |
75 | | > |
76 | | > jack dongarra, linpack, 3/11/78. |
77 | | > modified 3/93 to return if incx .le. 0. |
78 | | > modified 12/3/93, array(1) declarations changed to array(*) |
79 | | > \endverbatim |
80 | | > |
81 | | ===================================================================== */ |
82 | | doublereal igraphdasum_(integer *n, doublereal *dx, integer *incx) |
83 | 0 | { |
84 | | /* System generated locals */ |
85 | 0 | integer i__1, i__2; |
86 | 0 | doublereal ret_val, d__1, d__2, d__3, d__4, d__5, d__6; |
87 | | |
88 | | /* Local variables */ |
89 | 0 | integer i__, m, mp1; |
90 | 0 | doublereal dtemp; |
91 | 0 | integer nincx; |
92 | | |
93 | | |
94 | | /* -- Reference BLAS level1 routine (version 3.8.0) -- |
95 | | -- Reference BLAS is a software package provided by Univ. of Tennessee, -- |
96 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
97 | | November 2017 |
98 | | |
99 | | |
100 | | ===================================================================== |
101 | | |
102 | | Parameter adjustments */ |
103 | 0 | --dx; |
104 | | |
105 | | /* Function Body */ |
106 | 0 | ret_val = 0.; |
107 | 0 | dtemp = 0.; |
108 | 0 | if (*n <= 0 || *incx <= 0) { |
109 | 0 | return ret_val; |
110 | 0 | } |
111 | 0 | if (*incx == 1) { |
112 | | /* code for increment equal to 1 |
113 | | |
114 | | |
115 | | clean-up loop */ |
116 | |
|
117 | 0 | m = *n % 6; |
118 | 0 | if (m != 0) { |
119 | 0 | i__1 = m; |
120 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
121 | 0 | dtemp += (d__1 = dx[i__], abs(d__1)); |
122 | 0 | } |
123 | 0 | if (*n < 6) { |
124 | 0 | ret_val = dtemp; |
125 | 0 | return ret_val; |
126 | 0 | } |
127 | 0 | } |
128 | 0 | mp1 = m + 1; |
129 | 0 | i__1 = *n; |
130 | 0 | for (i__ = mp1; i__ <= i__1; i__ += 6) { |
131 | 0 | dtemp = dtemp + (d__1 = dx[i__], abs(d__1)) + (d__2 = dx[i__ + 1], |
132 | 0 | abs(d__2)) + (d__3 = dx[i__ + 2], abs(d__3)) + (d__4 = |
133 | 0 | dx[i__ + 3], abs(d__4)) + (d__5 = dx[i__ + 4], abs(d__5)) |
134 | 0 | + (d__6 = dx[i__ + 5], abs(d__6)); |
135 | 0 | } |
136 | 0 | } else { |
137 | | |
138 | | /* code for increment not equal to 1 */ |
139 | |
|
140 | 0 | nincx = *n * *incx; |
141 | 0 | i__1 = nincx; |
142 | 0 | i__2 = *incx; |
143 | 0 | for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { |
144 | 0 | dtemp += (d__1 = dx[i__], abs(d__1)); |
145 | 0 | } |
146 | 0 | } |
147 | 0 | ret_val = dtemp; |
148 | 0 | return ret_val; |
149 | 0 | } /* igraphdasum_ */ |
150 | | |