Télécharger dasum.eso

Retour à la liste

Numérotation des lignes :

dasum
  1. C DASUM SOURCE CB215821 16/04/21 21:16:15 8920
  2. FUNCTION DASUM(N,DX,INCX)
  3. C
  4. C TAKES THE SUM OF THE ABSOLUTE VALUES.
  5. C USES UNROLLED LOOPS FOR INCREMENT EQUAL TO ONE.
  6. C JACK DONGARRA, LINPACK, 3/11/78.
  7. C MODIFIED TO CORRECT PROBLEM WITH NEGATIVE INCREMENT, 8/21/90.
  8. C
  9. REAL*8 DX(*),DTEMP,DASUM
  10. INTEGER I,INCX,IX,M,MP1,N
  11. C
  12. DASUM = 0.0D0
  13. DTEMP = 0.0D0
  14. IF(N.LE.0)RETURN
  15. IF(INCX.EQ.1)GO TO 20
  16. C
  17. C CODE FOR INCREMENT NOT EQUAL TO 1
  18. C
  19. IX = 1
  20. IF(INCX.LT.0)IX = (-N+1)*INCX + 1
  21. DO 10 I = 1,N
  22. DTEMP = DTEMP + ABS(DX(IX))
  23. IX = IX + INCX
  24. 10 CONTINUE
  25. DASUM = DTEMP
  26. RETURN
  27. C
  28. C CODE FOR INCREMENT EQUAL TO 1
  29. C
  30. C
  31. C CLEAN-UP LOOP
  32. C
  33. 20 M = MOD(N,6)
  34. IF( M .EQ. 0 ) GO TO 40
  35. DO 30 I = 1,M
  36. DTEMP = DTEMP + ABS(DX(I))
  37. 30 CONTINUE
  38. IF( N .LT. 6 ) GO TO 60
  39. 40 MP1 = M + 1
  40. DO 50 I = MP1,N,6
  41. DTEMP = DTEMP + ABS(DX(I)) + ABS(DX(I + 1)) + ABS(DX(I + 2))
  42. * + ABS(DX(I + 3)) + ABS(DX(I + 4)) + ABS(DX(I + 5))
  43. 50 CONTINUE
  44. 60 DASUM = DTEMP
  45. RETURN
  46. END
  47.  
  48.  
  49.  
  50.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales