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.

izamax.f 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. *> \brief \b IZAMAX
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * INTEGER FUNCTION IZAMAX(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. *> IZAMAX finds the index of the first element having maximum |Re(.)| + |Im(.)|
  27. *> \endverbatim
  28. *
  29. * Arguments:
  30. * ==========
  31. *
  32. *> \param[in] N
  33. *> \verbatim
  34. *> N is INTEGER
  35. *> number of elements in input vector(s)
  36. *> \endverbatim
  37. *>
  38. *> \param[in] ZX
  39. *> \verbatim
  40. *> ZX is COMPLEX*16 array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
  41. *> \endverbatim
  42. *>
  43. *> \param[in] INCX
  44. *> \verbatim
  45. *> INCX is INTEGER
  46. *> storage spacing between elements of SX
  47. *> \endverbatim
  48. *
  49. * Authors:
  50. * ========
  51. *
  52. *> \author Univ. of Tennessee
  53. *> \author Univ. of California Berkeley
  54. *> \author Univ. of Colorado Denver
  55. *> \author NAG Ltd.
  56. *
  57. *> \date November 2017
  58. *
  59. *> \ingroup aux_blas
  60. *
  61. *> \par Further Details:
  62. * =====================
  63. *>
  64. *> \verbatim
  65. *>
  66. *> jack dongarra, 1/15/85.
  67. *> modified 3/93 to return if incx .le. 0.
  68. *> modified 12/3/93, array(1) declarations changed to array(*)
  69. *> \endverbatim
  70. *>
  71. * =====================================================================
  72. INTEGER FUNCTION IZAMAX(N,ZX,INCX)
  73. *
  74. * -- Reference BLAS level1 routine (version 3.8.0) --
  75. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  76. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  77. * November 2017
  78. *
  79. * .. Scalar Arguments ..
  80. INTEGER INCX,N
  81. * ..
  82. * .. Array Arguments ..
  83. COMPLEX*16 ZX(*)
  84. * ..
  85. *
  86. * =====================================================================
  87. *
  88. * .. Local Scalars ..
  89. DOUBLE PRECISION DMAX
  90. INTEGER I,IX
  91. * ..
  92. * .. External Functions ..
  93. DOUBLE PRECISION DCABS1
  94. EXTERNAL DCABS1
  95. * ..
  96. IZAMAX = 0
  97. IF (N.LT.1 .OR. INCX.LE.0) RETURN
  98. IZAMAX = 1
  99. IF (N.EQ.1) RETURN
  100. IF (INCX.EQ.1) THEN
  101. *
  102. * code for increment equal to 1
  103. *
  104. DMAX = DCABS1(ZX(1))
  105. DO I = 2,N
  106. IF (DCABS1(ZX(I)).GT.DMAX) THEN
  107. IZAMAX = I
  108. DMAX = DCABS1(ZX(I))
  109. END IF
  110. END DO
  111. ELSE
  112. *
  113. * code for increment not equal to 1
  114. *
  115. IX = 1
  116. DMAX = DCABS1(ZX(1))
  117. IX = IX + INCX
  118. DO I = 2,N
  119. IF (DCABS1(ZX(IX)).GT.DMAX) THEN
  120. IZAMAX = I
  121. DMAX = DCABS1(ZX(IX))
  122. END IF
  123. IX = IX + INCX
  124. END DO
  125. END IF
  126. RETURN
  127. END