LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
November 2017
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 73 of file dasum.f.

73 *
74 * -- Reference BLAS level1 routine (version 3.8.0) --
75 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
76 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
77 * November 2017
78 *
79 * .. Scalar Arguments ..
80  INTEGER incx,n
81 * ..
82 * .. Array Arguments ..
83  DOUBLE PRECISION dx(*)
84 * ..
85 *
86 * =====================================================================
87 *
88 * .. Local Scalars ..
89  DOUBLE PRECISION dtemp
90  INTEGER i,m,mp1,nincx
91 * ..
92 * .. Intrinsic Functions ..
93  INTRINSIC dabs,mod
94 * ..
95  dasum = 0.0d0
96  dtemp = 0.0d0
97  IF (n.LE.0 .OR. incx.LE.0) RETURN
98  IF (incx.EQ.1) THEN
99 * code for increment equal to 1
100 *
101 *
102 * clean-up loop
103 *
104  m = mod(n,6)
105  IF (m.NE.0) THEN
106  DO i = 1,m
107  dtemp = dtemp + dabs(dx(i))
108  END DO
109  IF (n.LT.6) THEN
110  dasum = dtemp
111  RETURN
112  END IF
113  END IF
114  mp1 = m + 1
115  DO i = mp1,n,6
116  dtemp = dtemp + dabs(dx(i)) + dabs(dx(i+1)) +
117  $ dabs(dx(i+2)) + dabs(dx(i+3)) +
118  $ dabs(dx(i+4)) + dabs(dx(i+5))
119  END DO
120  ELSE
121 *
122 * code for increment not equal to 1
123 *
124  nincx = n*incx
125  DO i = 1,nincx,incx
126  dtemp = dtemp + dabs(dx(i))
127  END DO
128  END IF
129  dasum = dtemp
130  RETURN
double precision function dasum(N, DX, INCX)
DASUM
Definition: dasum.f:73
Here is the caller graph for this function: