```001:       SUBROUTINE ZDRSCL( N, SA, SX, INCX )
002: *
003: *  -- LAPACK auxiliary routine (version 3.2) --
004: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
005: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
006: *     November 2006
007: *
008: *     .. Scalar Arguments ..
009:       INTEGER            INCX, N
010:       DOUBLE PRECISION   SA
011: *     ..
012: *     .. Array Arguments ..
013:       COMPLEX*16         SX( * )
014: *     ..
015: *
016: *  Purpose
017: *  =======
018: *
019: *  ZDRSCL multiplies an n-element complex vector x by the real scalar
020: *  1/a.  This is done without overflow or underflow as long as
021: *  the final result x/a does not overflow or underflow.
022: *
023: *  Arguments
024: *  =========
025: *
026: *  N       (input) INTEGER
027: *          The number of components of the vector x.
028: *
029: *  SA      (input) DOUBLE PRECISION
030: *          The scalar a which is used to divide each component of x.
031: *          SA must be >= 0, or the subroutine will divide by zero.
032: *
033: *  SX      (input/output) COMPLEX*16 array, dimension
034: *                         (1+(N-1)*abs(INCX))
035: *          The n-element vector x.
036: *
037: *  INCX    (input) INTEGER
038: *          The increment between successive values of the vector SX.
039: *          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n
040: *
041: * =====================================================================
042: *
043: *     .. Parameters ..
044:       DOUBLE PRECISION   ZERO, ONE
045:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
046: *     ..
047: *     .. Local Scalars ..
048:       LOGICAL            DONE
049:       DOUBLE PRECISION   BIGNUM, CDEN, CDEN1, CNUM, CNUM1, MUL, SMLNUM
050: *     ..
051: *     .. External Functions ..
052:       DOUBLE PRECISION   DLAMCH
053:       EXTERNAL           DLAMCH
054: *     ..
055: *     .. External Subroutines ..
056:       EXTERNAL           DLABAD, ZDSCAL
057: *     ..
058: *     .. Intrinsic Functions ..
059:       INTRINSIC          ABS
060: *     ..
061: *     .. Executable Statements ..
062: *
063: *     Quick return if possible
064: *
065:       IF( N.LE.0 )
066:      \$   RETURN
067: *
068: *     Get machine parameters
069: *
070:       SMLNUM = DLAMCH( 'S' )
071:       BIGNUM = ONE / SMLNUM
072:       CALL DLABAD( SMLNUM, BIGNUM )
073: *
074: *     Initialize the denominator to SA and the numerator to 1.
075: *
076:       CDEN = SA
077:       CNUM = ONE
078: *
079:    10 CONTINUE
080:       CDEN1 = CDEN*SMLNUM
081:       CNUM1 = CNUM / BIGNUM
082:       IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
083: *
084: *        Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
085: *
086:          MUL = SMLNUM
087:          DONE = .FALSE.
088:          CDEN = CDEN1
089:       ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
090: *
091: *        Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
092: *
093:          MUL = BIGNUM
094:          DONE = .FALSE.
095:          CNUM = CNUM1
096:       ELSE
097: *
098: *        Multiply X by CNUM / CDEN and return.
099: *
100:          MUL = CNUM / CDEN
101:          DONE = .TRUE.
102:       END IF
103: *
104: *     Scale the vector X by MUL
105: *
106:       CALL ZDSCAL( N, MUL, SX, INCX )
107: *
108:       IF( .NOT.DONE )
109:      \$   GO TO 10
110: *
111:       RETURN
112: *
113: *     End of ZDRSCL
114: *
115:       END
116: ```