1       LOGICAL          FUNCTION ZLCTES( Z, D )
 2 *
 3 *  -- LAPACK test routine (version 3.1) --
 4 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
 5 *     November 2006
 6 *
 7 *     .. Scalar Arguments ..
 8       COMPLEX*16         D, Z
 9 *     ..
10 *
11 *  Purpose
12 *  =======
13 *
14 *  ZLCTES returns .TRUE. if the eigenvalue Z/D is to be selected
15 *  (specifically, in this subroutine, if the real part of the
16 *  eigenvalue is negative), and otherwise it returns .FALSE..
17 *
18 *  It is used by the test routine ZDRGES to test whether the driver
19 *  routine ZGGES succesfully sorts eigenvalues.
20 *
21 *  Arguments
22 *  =========
23 *
24 *  Z       (input) COMPLEX*16
25 *          The numerator part of a complex eigenvalue Z/D.
26 *
27 *  D       (input) COMPLEX*16
28 *          The denominator part of a complex eigenvalue Z/D.
29 *
30 *  =====================================================================
31 *
32 *     .. Parameters ..
33 *
34       DOUBLE PRECISION   ZERO, ONE
35       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
36       COMPLEX*16         CZERO
37       PARAMETER          ( CZERO = ( 0.0D+00.0D+0 ) )
38 *     ..
39 *     .. Local Scalars ..
40       DOUBLE PRECISION   ZMAX
41 *     ..
42 *     .. Intrinsic Functions ..
43       INTRINSIC          ABSDBLEDIMAGMAXSIGN
44 *     ..
45 *     .. Executable Statements ..
46 *
47       IF( D.EQ.CZERO ) THEN
48          ZLCTES = ( DBLE( Z ).LT.ZERO )
49       ELSE
50          IFDBLE( Z ).EQ.ZERO .OR. DBLE( D ).EQ.ZERO ) THEN
51             ZLCTES = ( SIGN( ONE, DIMAG( Z ) ).NE.
52      $               SIGN( ONE, DIMAG( D ) ) )
53          ELSE IFDIMAG( Z ).EQ.ZERO .OR. DIMAG( D ).EQ.ZERO ) THEN
54             ZLCTES = ( SIGN( ONE, DBLE( Z ) ).NE.
55      $               SIGN( ONE, DBLE( D ) ) )
56          ELSE
57             ZMAX = MAXABSDBLE( Z ) ), ABSDIMAG( Z ) ) )
58             ZLCTES = ( ( DBLE( Z ) / ZMAX )*DBLE( D )+
59      $               ( DIMAG( Z ) / ZMAX )*DIMAG( D ).LT.ZERO )
60          END IF
61       END IF
62 *
63       RETURN
64 *
65 *     End of ZLCTES
66 *
67       END