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.

sslect.f 2.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. *> \brief \b SSLECT
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * LOGICAL FUNCTION SSLECT( ZR, ZI )
  12. *
  13. * .. Scalar Arguments ..
  14. * REAL ZI, ZR
  15. * ..
  16. *
  17. *
  18. *> \par Purpose:
  19. * =============
  20. *>
  21. *> \verbatim
  22. *>
  23. *> SSLECT returns .TRUE. if the eigenvalue ZR+sqrt(-1)*ZI is to be
  24. *> selected, and otherwise it returns .FALSE.
  25. *> It is used by SCHK41 to test if SGEES successfully sorts eigenvalues,
  26. *> and by SCHK43 to test if SGEESX successfully sorts eigenvalues.
  27. *>
  28. *> The common block /SSLCT/ controls how eigenvalues are selected.
  29. *> If SELOPT = 0, then SSLECT return .TRUE. when ZR is less than zero,
  30. *> and .FALSE. otherwise.
  31. *> If SELOPT is at least 1, SSLECT returns SELVAL(SELOPT) and adds 1
  32. *> to SELOPT, cycling back to 1 at SELMAX.
  33. *> \endverbatim
  34. *
  35. * Arguments:
  36. * ==========
  37. *
  38. *> \param[in] ZR
  39. *> \verbatim
  40. *> ZR is REAL
  41. *> The real part of a complex eigenvalue ZR + i*ZI.
  42. *> \endverbatim
  43. *>
  44. *> \param[in] ZI
  45. *> \verbatim
  46. *> ZI is REAL
  47. *> The imaginary part of a complex eigenvalue ZR + i*ZI.
  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. *> \ingroup single_eig
  59. *
  60. * =====================================================================
  61. LOGICAL FUNCTION SSLECT( ZR, ZI )
  62. *
  63. * -- LAPACK test routine --
  64. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  65. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  66. *
  67. * .. Scalar Arguments ..
  68. REAL ZI, ZR
  69. * ..
  70. *
  71. * =====================================================================
  72. *
  73. * .. Arrays in Common ..
  74. LOGICAL SELVAL( 20 )
  75. REAL SELWI( 20 ), SELWR( 20 )
  76. * ..
  77. * .. Scalars in Common ..
  78. INTEGER SELDIM, SELOPT
  79. * ..
  80. * .. Common blocks ..
  81. COMMON / SSLCT / SELOPT, SELDIM, SELVAL, SELWR, SELWI
  82. * ..
  83. * .. Local Scalars ..
  84. INTEGER I
  85. REAL RMIN, X
  86. * ..
  87. * .. Parameters ..
  88. REAL ZERO
  89. PARAMETER ( ZERO = 0.0E0 )
  90. * ..
  91. * .. External Functions ..
  92. REAL SLAPY2
  93. EXTERNAL SLAPY2
  94. * ..
  95. * .. Executable Statements ..
  96. *
  97. IF( SELOPT.EQ.0 ) THEN
  98. SSLECT = ( ZR.LT.ZERO )
  99. ELSE
  100. RMIN = SLAPY2( ZR-SELWR( 1 ), ZI-SELWI( 1 ) )
  101. SSLECT = SELVAL( 1 )
  102. DO 10 I = 2, SELDIM
  103. X = SLAPY2( ZR-SELWR( I ), ZI-SELWI( I ) )
  104. IF( X.LE.RMIN ) THEN
  105. RMIN = X
  106. SSLECT = SELVAL( I )
  107. END IF
  108. 10 CONTINUE
  109. END IF
  110. RETURN
  111. *
  112. * End of SSLECT
  113. *
  114. END