Annotation of rpl/lapack/blas/dasum.f, revision 1.7
1.1 bertrand 1: DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX)
2: * .. Scalar Arguments ..
3: INTEGER INCX,N
4: * ..
5: * .. Array Arguments ..
6: DOUBLE PRECISION DX(*)
7: * ..
8: *
9: * Purpose
10: * =======
11: *
12: * DASUM takes the sum of the absolute values.
13: *
14: * Further Details
15: * ===============
16: *
17: * jack dongarra, linpack, 3/11/78.
18: * modified 3/93 to return if incx .le. 0.
19: * modified 12/3/93, array(1) declarations changed to array(*)
20: *
21: * =====================================================================
22: *
23: * .. Local Scalars ..
24: DOUBLE PRECISION DTEMP
25: INTEGER I,M,MP1,NINCX
26: * ..
27: * .. Intrinsic Functions ..
28: INTRINSIC DABS,MOD
29: * ..
30: DASUM = 0.0d0
31: DTEMP = 0.0d0
32: IF (N.LE.0 .OR. INCX.LE.0) RETURN
1.7 ! bertrand 33: IF (INCX.EQ.1) THEN
! 34: * code for increment equal to 1
1.1 bertrand 35: *
36: *
1.7 ! bertrand 37: * clean-up loop
1.1 bertrand 38: *
1.7 ! bertrand 39: M = MOD(N,6)
! 40: IF (M.NE.0) THEN
! 41: DO I = 1,M
! 42: DTEMP = DTEMP + DABS(DX(I))
! 43: END DO
! 44: IF (N.LT.6) THEN
! 45: DASUM = DTEMP
! 46: RETURN
! 47: END IF
! 48: END IF
! 49: MP1 = M + 1
! 50: DO I = MP1,N,6
! 51: DTEMP = DTEMP + DABS(DX(I)) + DABS(DX(I+1)) +
! 52: $ DABS(DX(I+2)) + DABS(DX(I+3)) +
! 53: $ DABS(DX(I+4)) + DABS(DX(I+5))
! 54: END DO
! 55: ELSE
1.1 bertrand 56: *
1.7 ! bertrand 57: * code for increment not equal to 1
1.1 bertrand 58: *
1.7 ! bertrand 59: NINCX = N*INCX
! 60: DO I = 1,NINCX,INCX
! 61: DTEMP = DTEMP + DABS(DX(I))
! 62: END DO
! 63: END IF
! 64: DASUM = DTEMP
1.1 bertrand 65: RETURN
66: END
CVSweb interface <joel.bertrand@systella.fr>