PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
zdrscl.f
Go to the documentation of this file.
1  SUBROUTINE zdrscl( N, SA, SX, INCX )
2 *
3 * -- LAPACK auxiliary routine (version 3.2) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8  INTEGER incx, n
9  DOUBLE PRECISION sa
10 * ..
11 * .. Array Arguments ..
12  COMPLEX*16 sx( * )
13 * ..
14 *
15 * Purpose
16 * =======
17 *
18 * ZDRSCL multiplies an n-element complex vector x by the real scalar
19 * 1/a. This is done without overflow or underflow as long as
20 * the final result x/a does not overflow or underflow.
21 *
22 * Arguments
23 * =========
24 *
25 * N (input) INTEGER
26 * The number of components of the vector x.
27 *
28 * SA (input) DOUBLE PRECISION
29 * The scalar a which is used to divide each component of x.
30 * SA must be >= 0, or the subroutine will divide by zero.
31 *
32 * SX (input/output) COMPLEX*16 array, dimension
33 * (1+(N-1)*abs(INCX))
34 * The n-element vector x.
35 *
36 * INCX (input) INTEGER
37 * The increment between successive values of the vector SX.
38 * > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n
39 *
40 * =====================================================================
41 *
42 * .. Parameters ..
43  DOUBLE PRECISION zero, one
44  parameter( zero = 0.0d+0, one = 1.0d+0 )
45 * ..
46 * .. Local Scalars ..
47  LOGICAL done
48  DOUBLE PRECISION bignum, cden, cden1, cnum, cnum1, mul, smlnum
49 * ..
50 * .. External Functions ..
51  DOUBLE PRECISION dlamch
52  EXTERNAL dlamch
53 * ..
54 * .. External Subroutines ..
55  EXTERNAL dlabad, zdscal
56 * ..
57 * .. Intrinsic Functions ..
58  INTRINSIC abs
59 * ..
60 * .. Executable Statements ..
61 *
62 * Quick return if possible
63 *
64  IF( n.LE.0 )
65  $ return
66 *
67 * Get machine parameters
68 *
69  smlnum = dlamch( 'S' )
70  bignum = one / smlnum
71  CALL dlabad( smlnum, bignum )
72 *
73 * Initialize the denominator to SA and the numerator to 1.
74 *
75  cden = sa
76  cnum = one
77 *
78  10 continue
79  cden1 = cden*smlnum
80  cnum1 = cnum / bignum
81  IF( abs( cden1 ).GT.abs( cnum ) .AND. cnum.NE.zero ) THEN
82 *
83 * Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
84 *
85  mul = smlnum
86  done = .false.
87  cden = cden1
88  ELSE IF( abs( cnum1 ).GT.abs( cden ) ) THEN
89 *
90 * Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
91 *
92  mul = bignum
93  done = .false.
94  cnum = cnum1
95  ELSE
96 *
97 * Multiply X by CNUM / CDEN and return.
98 *
99  mul = cnum / cden
100  done = .true.
101  END IF
102 *
103 * Scale the vector X by MUL
104 *
105  CALL zdscal( n, mul, sx, incx )
106 *
107  IF( .NOT.done )
108  $ go to 10
109 *
110  return
111 *
112 * End of ZDRSCL
113 *
114  END