1*> \brief \b ZSLECT
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 ZSLECT( Z )
12*
13*       .. Scalar Arguments ..
14*       COMPLEX*16         Z
15*       ..
16*
17*
18*> \par Purpose:
19*  =============
20*>
21*> \verbatim
22*>
23*> ZSLECT returns .TRUE. if the eigenvalue Z is to be selected,
24*> otherwise it returns .FALSE.
25*> It is used by ZCHK41 to test if ZGEES successfully sorts eigenvalues,
26*> and by ZCHK43 to test if ZGEESX successfully sorts eigenvalues.
27*>
28*> The common block /SSLCT/ controls how eigenvalues are selected.
29*> If SELOPT = 0, then ZSLECT return .TRUE. when real(Z) is less than
30*> zero, and .FALSE. otherwise.
31*> If SELOPT is at least 1, ZSLECT 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] Z
39*> \verbatim
40*>          Z is COMPLEX*16
41*>          The eigenvalue Z.
42*> \endverbatim
43*
44*  Authors:
45*  ========
46*
47*> \author Univ. of Tennessee
48*> \author Univ. of California Berkeley
49*> \author Univ. of Colorado Denver
50*> \author NAG Ltd.
51*
52*> \ingroup complex16_eig
53*
54*  =====================================================================
55      LOGICAL          FUNCTION ZSLECT( Z )
56*
57*  -- LAPACK test routine --
58*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
59*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
60*
61*     .. Scalar Arguments ..
62      COMPLEX*16         Z
63*     ..
64*
65*  =====================================================================
66*
67*     .. Parameters ..
68      DOUBLE PRECISION   ZERO
69      PARAMETER          ( ZERO = 0.0D0 )
70*     ..
71*     .. Local Scalars ..
72      INTEGER            I
73      DOUBLE PRECISION   RMIN, X
74*     ..
75*     .. Scalars in Common ..
76      INTEGER            SELDIM, SELOPT
77*     ..
78*     .. Arrays in Common ..
79      LOGICAL            SELVAL( 20 )
80      DOUBLE PRECISION   SELWI( 20 ), SELWR( 20 )
81*     ..
82*     .. Common blocks ..
83      COMMON             / SSLCT / SELOPT, SELDIM, SELVAL, SELWR, SELWI
84*     ..
85*     .. Intrinsic Functions ..
86      INTRINSIC          ABS, DBLE, DCMPLX
87*     ..
88*     .. Executable Statements ..
89*
90      IF( SELOPT.EQ.0 ) THEN
91         ZSLECT = ( DBLE( Z ).LT.ZERO )
92      ELSE
93         RMIN = ABS( Z-DCMPLX( SELWR( 1 ), SELWI( 1 ) ) )
94         ZSLECT = SELVAL( 1 )
95         DO 10 I = 2, SELDIM
96            X = ABS( Z-DCMPLX( SELWR( I ), SELWI( I ) ) )
97            IF( X.LE.RMIN ) THEN
98               RMIN = X
99               ZSLECT = SELVAL( I )
100            END IF
101   10    CONTINUE
102      END IF
103      RETURN
104*
105*     End of ZSLECT
106*
107      END
108