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.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 (|Re(.)| + |Im(.)|)'s of a complex vector and
  27. *> returns a single precision result.
  28. *> \endverbatim
  29. *
  30. * Arguments:
  31. * ==========
  32. *
  33. *> \param[in] N
  34. *> \verbatim
  35. *> N is INTEGER
  36. *> number of elements in input vector(s)
  37. *> \endverbatim
  38. *>
  39. *> \param[in,out] ZX
  40. *> \verbatim
  41. *> ZX is COMPLEX*16 array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
  42. *> \endverbatim
  43. *>
  44. *> \param[in] INCX
  45. *> \verbatim
  46. *> INCX is INTEGER
  47. *> storage spacing between elements of ZX
  48. *> \endverbatim
  49. *
  50. * Authors:
  51. * ========
  52. *
  53. *> \author Univ. of Tennessee
  54. *> \author Univ. of California Berkeley
  55. *> \author Univ. of Colorado Denver
  56. *> \author NAG Ltd.
  57. *
  58. *> \date November 2017
  59. *
  60. *> \ingroup double_blas_level1
  61. *
  62. *> \par Further Details:
  63. * =====================
  64. *>
  65. *> \verbatim
  66. *>
  67. *> jack dongarra, 3/11/78.
  68. *> modified 3/93 to return if incx .le. 0.
  69. *> modified 12/3/93, array(1) declarations changed to array(*)
  70. *> \endverbatim
  71. *>
  72. * =====================================================================
  73. DOUBLE PRECISION FUNCTION DZASUM(N,ZX,INCX)
  74. *
  75. * -- Reference BLAS level1 routine (version 3.8.0) --
  76. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  77. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  78. * November 2017
  79. *
  80. * .. Scalar Arguments ..
  81. INTEGER INCX,N
  82. * ..
  83. * .. Array Arguments ..
  84. COMPLEX*16 ZX(*)
  85. * ..
  86. *
  87. * =====================================================================
  88. *
  89. * .. Local Scalars ..
  90. DOUBLE PRECISION STEMP
  91. INTEGER I,NINCX
  92. * ..
  93. * .. External Functions ..
  94. DOUBLE PRECISION DCABS1
  95. EXTERNAL DCABS1
  96. * ..
  97. DZASUM = 0.0d0
  98. STEMP = 0.0d0
  99. IF (N.LE.0 .OR. INCX.LE.0) RETURN
  100. IF (INCX.EQ.1) THEN
  101. *
  102. * code for increment equal to 1
  103. *
  104. DO I = 1,N
  105. STEMP = STEMP + DCABS1(ZX(I))
  106. END DO
  107. ELSE
  108. *
  109. * code for increment not equal to 1
  110. *
  111. NINCX = N*INCX
  112. DO I = 1,NINCX,INCX
  113. STEMP = STEMP + DCABS1(ZX(I))
  114. END DO
  115. END IF
  116. DZASUM = STEMP
  117. RETURN
  118. END