LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dasum()

double precision function dasum ( integer  n,
double precision, dimension(*)  dx,
integer  incx 
)

DASUM

Purpose:
    DASUM takes the sum of the absolute values.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]DX
          DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of DX
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 3/93 to return if incx .le. 0.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 70 of file dasum.f.

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*
double precision function dasum(n, dx, incx)
DASUM
Definition dasum.f:71
Here is the call graph for this function:
Here is the caller graph for this function: