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.

cdotc.f 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. *> \brief \b CDOTC
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY)
  12. *
  13. * .. Scalar Arguments ..
  14. * INTEGER INCX,INCY,N
  15. * ..
  16. * .. Array Arguments ..
  17. * COMPLEX CX(*),CY(*)
  18. * ..
  19. *
  20. *
  21. *> \par Purpose:
  22. * =============
  23. *>
  24. *> \verbatim
  25. *>
  26. *> CDOTC forms the dot product of two complex vectors
  27. *> CDOTC = X^H * Y
  28. *>
  29. *> \endverbatim
  30. *
  31. * Arguments:
  32. * ==========
  33. *
  34. *> \param[in] N
  35. *> \verbatim
  36. *> N is INTEGER
  37. *> number of elements in input vector(s)
  38. *> \endverbatim
  39. *>
  40. *> \param[in] CX
  41. *> \verbatim
  42. *> CX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
  43. *> \endverbatim
  44. *>
  45. *> \param[in] INCX
  46. *> \verbatim
  47. *> INCX is INTEGER
  48. *> storage spacing between elements of CX
  49. *> \endverbatim
  50. *>
  51. *> \param[in] CY
  52. *> \verbatim
  53. *> CY is REAL array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
  54. *> \endverbatim
  55. *>
  56. *> \param[in] INCY
  57. *> \verbatim
  58. *> INCY is INTEGER
  59. *> storage spacing between elements of CY
  60. *> \endverbatim
  61. *
  62. * Authors:
  63. * ========
  64. *
  65. *> \author Univ. of Tennessee
  66. *> \author Univ. of California Berkeley
  67. *> \author Univ. of Colorado Denver
  68. *> \author NAG Ltd.
  69. *
  70. *> \date November 2017
  71. *
  72. *> \ingroup complex_blas_level1
  73. *
  74. *> \par Further Details:
  75. * =====================
  76. *>
  77. *> \verbatim
  78. *>
  79. *> jack dongarra, linpack, 3/11/78.
  80. *> modified 12/3/93, array(1) declarations changed to array(*)
  81. *> \endverbatim
  82. *>
  83. * =====================================================================
  84. COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY)
  85. *
  86. * -- Reference BLAS level1 routine (version 3.8.0) --
  87. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  88. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  89. * November 2017
  90. *
  91. * .. Scalar Arguments ..
  92. INTEGER INCX,INCY,N
  93. * ..
  94. * .. Array Arguments ..
  95. COMPLEX CX(*),CY(*)
  96. * ..
  97. *
  98. * =====================================================================
  99. *
  100. * .. Local Scalars ..
  101. COMPLEX CTEMP
  102. INTEGER I,IX,IY
  103. * ..
  104. * .. Intrinsic Functions ..
  105. INTRINSIC CONJG
  106. * ..
  107. CTEMP = (0.0,0.0)
  108. CDOTC = (0.0,0.0)
  109. IF (N.LE.0) RETURN
  110. IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
  111. *
  112. * code for both increments equal to 1
  113. *
  114. DO I = 1,N
  115. CTEMP = CTEMP + CONJG(CX(I))*CY(I)
  116. END DO
  117. ELSE
  118. *
  119. * code for unequal increments or equal increments
  120. * not equal to 1
  121. *
  122. IX = 1
  123. IY = 1
  124. IF (INCX.LT.0) IX = (-N+1)*INCX + 1
  125. IF (INCY.LT.0) IY = (-N+1)*INCY + 1
  126. DO I = 1,N
  127. CTEMP = CTEMP + CONJG(CX(IX))*CY(IY)
  128. IX = IX + INCX
  129. IY = IY + INCY
  130. END DO
  131. END IF
  132. CDOTC = CTEMP
  133. RETURN
  134. END