Annotation of rpl/lapack/blas/dasum.f, revision 1.16
1.8 bertrand 1: *> \brief \b DASUM
2: *
3: * =========== DOCUMENTATION ===========
4: *
1.13 bertrand 5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
1.8 bertrand 7: *
8: * Definition:
9: * ===========
10: *
11: * DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX)
1.13 bertrand 12: *
1.8 bertrand 13: * .. Scalar Arguments ..
14: * INTEGER INCX,N
15: * ..
16: * .. Array Arguments ..
17: * DOUBLE PRECISION DX(*)
18: * ..
1.13 bertrand 19: *
1.8 bertrand 20: *
21: *> \par Purpose:
22: * =============
23: *>
24: *> \verbatim
25: *>
26: *> DASUM takes the sum of the absolute values.
27: *> \endverbatim
28: *
1.14 bertrand 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: *
1.8 bertrand 49: * Authors:
50: * ========
51: *
1.13 bertrand 52: *> \author Univ. of Tennessee
53: *> \author Univ. of California Berkeley
54: *> \author Univ. of Colorado Denver
55: *> \author NAG Ltd.
1.8 bertrand 56: *
57: *> \ingroup double_blas_level1
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: * =====================================================================
1.1 bertrand 70: DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX)
1.8 bertrand 71: *
1.16 ! bertrand 72: * -- Reference BLAS level1 routine --
1.8 bertrand 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: *
1.1 bertrand 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
1.7 bertrand 95: IF (INCX.EQ.1) THEN
96: * code for increment equal to 1
1.1 bertrand 97: *
98: *
1.7 bertrand 99: * clean-up loop
1.1 bertrand 100: *
1.7 bertrand 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
1.1 bertrand 118: *
1.7 bertrand 119: * code for increment not equal to 1
1.1 bertrand 120: *
1.7 bertrand 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
1.1 bertrand 127: RETURN
1.16 ! bertrand 128: *
! 129: * End of DASUM
! 130: *
1.1 bertrand 131: END
CVSweb interface <joel.bertrand@systella.fr>