1
SUBROUTINE DRSCL( N, SA, SX, INCX )
3
* -- LAPACK auxiliary routine (version 2.0) --
4
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5
* Courant Institute, Argonne National Lab, and Rice University
8
* .. Scalar Arguments ..
12
* .. Array Arguments ..
13
DOUBLE PRECISION SX( * )
19
* DRSCL multiplies an n-element real vector x by the real scalar 1/a.
20
* This is done without overflow or underflow as long as
21
* the final result x/a does not overflow or underflow.
27
* The number of components of the vector x.
29
* SA (input) DOUBLE PRECISION
30
* The scalar a which is used to divide each component of x.
31
* SA must be >= 0, or the subroutine will divide by zero.
33
* SX (input/output) DOUBLE PRECISION array, dimension
35
* The n-element vector x.
37
* INCX (input) INTEGER
38
* The increment between successive values of the vector SX.
39
* > 0: SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i), 1< i<= n
41
* =====================================================================
44
DOUBLE PRECISION ONE, ZERO
45
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
49
DOUBLE PRECISION BIGNUM, CDEN, CDEN1, CNUM, CNUM1, MUL, SMLNUM
51
* .. External Functions ..
52
DOUBLE PRECISION DLAMCH
55
* .. External Subroutines ..
56
EXTERNAL DLABAD, DSCAL
58
* .. Intrinsic Functions ..
61
* .. Executable Statements ..
63
* Quick return if possible
68
* Get machine parameters
70
SMLNUM = DLAMCH( 'S' )
72
CALL DLABAD( SMLNUM, BIGNUM )
74
* Initialize the denominator to SA and the numerator to 1.
82
IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
84
* Pre-multiply X by SMLNUM if CDEN is large compared to CNUM.
89
ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
91
* Pre-multiply X by BIGNUM if CDEN is small compared to CNUM.
98
* Multiply X by CNUM / CDEN and return.
104
* Scale the vector X by MUL
106
CALL DSCAL( N, MUL, SX, INCX )