LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dasum.f
Go to the documentation of this file.
1*> \brief \b DASUM
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX)
12*
13* .. Scalar Arguments ..
14* INTEGER INCX,N
15* ..
16* .. Array Arguments ..
17* DOUBLE PRECISION DX(*)
18* ..
19*
20*
21*> \par Purpose:
22* =============
23*>
24*> \verbatim
25*>
26*> DASUM takes the sum of the absolute values.
27*> \endverbatim
28*
29* Arguments:
30* ==========
31*
32*> \param[in] N
33*> \verbatim
34*> N is INTEGER
35*> number of elements in input vector(s)
36*> \endverbatim
37*>
38*> \param[in] DX
39*> \verbatim
40*> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
41*> \endverbatim
42*>
43*> \param[in] INCX
44*> \verbatim
45*> INCX is INTEGER
46*> storage spacing between elements of DX
47*> \endverbatim
48*
49* Authors:
50* ========
51*
52*> \author Univ. of Tennessee
53*> \author Univ. of California Berkeley
54*> \author Univ. of Colorado Denver
55*> \author NAG Ltd.
56*
57*> \ingroup asum
58*
59*> \par Further Details:
60* =====================
61*>
62*> \verbatim
63*>
64*> jack dongarra, linpack, 3/11/78.
65*> modified 3/93 to return if incx .le. 0.
66*> modified 12/3/93, array(1) declarations changed to array(*)
67*> \endverbatim
68*>
69* =====================================================================
70 DOUBLE PRECISION FUNCTION dasum(N,DX,INCX)
71*
72* -- Reference BLAS level1 routine --
73* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
74* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
75*
76* .. Scalar Arguments ..
77 INTEGER incx,n
78* ..
79* .. Array Arguments ..
80 DOUBLE PRECISION dx(*)
81* ..
82*
83* =====================================================================
84*
85* .. Local Scalars ..
86 DOUBLE PRECISION dtemp
87 INTEGER i,m,mp1,nincx
88* ..
89* .. Intrinsic Functions ..
90 INTRINSIC dabs,mod
91* ..
92 dasum = 0.0d0
93 dtemp = 0.0d0
94 IF (n.LE.0 .OR. incx.LE.0) RETURN
95 IF (incx.EQ.1) THEN
96* code for increment equal to 1
97*
98*
99* clean-up loop
100*
101 m = mod(n,6)
102 IF (m.NE.0) THEN
103 DO i = 1,m
104 dtemp = dtemp + dabs(dx(i))
105 END DO
106 IF (n.LT.6) THEN
107 dasum = dtemp
108 RETURN
109 END IF
110 END IF
111 mp1 = m + 1
112 DO i = mp1,n,6
113 dtemp = dtemp + dabs(dx(i)) + dabs(dx(i+1)) +
114 $ dabs(dx(i+2)) + dabs(dx(i+3)) +
115 $ dabs(dx(i+4)) + dabs(dx(i+5))
116 END DO
117 ELSE
118*
119* code for increment not equal to 1
120*
121 nincx = n*incx
122 DO i = 1,nincx,incx
123 dtemp = dtemp + dabs(dx(i))
124 END DO
125 END IF
126 dasum = dtemp
127 RETURN
128*
129* End of DASUM
130*
131 END
double precision function dasum(n, dx, incx)
DASUM
Definition dasum.f:71