You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dzasum.f 2.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. *> \brief \b DZASUM
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * DOUBLE PRECISION FUNCTION DZASUM(N,ZX,INCX)
  12. *
  13. * .. Scalar Arguments ..
  14. * INTEGER INCX,N
  15. * ..
  16. * .. Array Arguments ..
  17. * COMPLEX*16 ZX(*)
  18. * ..
  19. *
  20. *
  21. *> \par Purpose:
  22. * =============
  23. *>
  24. *> \verbatim
  25. *>
  26. *> DZASUM takes the sum of the absolute values.
  27. *> \endverbatim
  28. *
  29. * Authors:
  30. * ========
  31. *
  32. *> \author Univ. of Tennessee
  33. *> \author Univ. of California Berkeley
  34. *> \author Univ. of Colorado Denver
  35. *> \author NAG Ltd.
  36. *
  37. *> \date November 2011
  38. *
  39. *> \ingroup double_blas_level1
  40. *
  41. *> \par Further Details:
  42. * =====================
  43. *>
  44. *> \verbatim
  45. *>
  46. *> jack dongarra, 3/11/78.
  47. *> modified 3/93 to return if incx .le. 0.
  48. *> modified 12/3/93, array(1) declarations changed to array(*)
  49. *> \endverbatim
  50. *>
  51. * =====================================================================
  52. DOUBLE PRECISION FUNCTION DZASUM(N,ZX,INCX)
  53. *
  54. * -- Reference BLAS level1 routine (version 3.4.0) --
  55. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  56. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  57. * November 2011
  58. *
  59. * .. Scalar Arguments ..
  60. INTEGER INCX,N
  61. * ..
  62. * .. Array Arguments ..
  63. COMPLEX*16 ZX(*)
  64. * ..
  65. *
  66. * =====================================================================
  67. *
  68. * .. Local Scalars ..
  69. DOUBLE PRECISION STEMP
  70. INTEGER I,NINCX
  71. * ..
  72. * .. External Functions ..
  73. DOUBLE PRECISION DCABS1
  74. EXTERNAL DCABS1
  75. * ..
  76. DZASUM = 0.0d0
  77. STEMP = 0.0d0
  78. IF (N.LE.0 .OR. INCX.LE.0) RETURN
  79. IF (INCX.EQ.1) THEN
  80. *
  81. * code for increment equal to 1
  82. *
  83. DO I = 1,N
  84. STEMP = STEMP + DCABS1(ZX(I))
  85. END DO
  86. ELSE
  87. *
  88. * code for increment not equal to 1
  89. *
  90. NINCX = N*INCX
  91. DO I = 1,NINCX,INCX
  92. STEMP = STEMP + DCABS1(ZX(I))
  93. END DO
  94. END IF
  95. DZASUM = STEMP
  96. RETURN
  97. END