2 SUBROUTINE DSCAL
(N
, DA
, DX
, INCX
)
3 C***BEGIN PROLOGUE DSCAL
4 C***PURPOSE Multiply a vector by a constant.
6 C***TYPE DOUBLE PRECISION (SSCAL-S, DSCAL-D, CSCAL-C)
7 C***KEYWORDS BLAS, LINEAR ALGEBRA, SCALE, VECTOR
8 C***AUTHOR Lawson, C. L., (JPL)
9 C Hanson, R. J., (SNLA)
10 C Kincaid, D. R., (U. of Texas)
15 C Description of Parameters
18 C N number of elements in input vector(s)
19 C DA double precision scale factor
20 C DX double precision vector with N elements
21 C INCX storage spacing between elements of DX
24 C DX double precision result (unchanged if N.LE.0)
26 C Replace double precision DX by double precision DA*DX.
27 C For I = 0 to N-1, replace DX(IX+I*INCX) with DA * DX(IX+I*INCX),
28 C where IX = 1 if INCX .GE. 0, else IX = 1+(1-N)*INCX.
30 C***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
31 C Krogh, Basic linear algebra subprograms for Fortran
32 C usage, Algorithm No. 539, Transactions on Mathematical
33 C Software 5, 3 (September 1979), pp. 308-323.
34 C***ROUTINES CALLED (NONE)
35 C***REVISION HISTORY (YYMMDD)
37 C 890831 Modified array declarations. (WRB)
38 C 890831 REVISION DATE from Version 3.2
39 C 891214 Prologue converted to Version 4.0 format. (BAB)
40 C 900821 Modified to correct problem with a negative increment.
42 C 920501 Reformatted the REFERENCES section. (WRB)
43 C***END PROLOGUE DSCAL
44 DOUBLE PRECISION DA
, DX
(*)
45 INTEGER I
, INCX
, IX
, M
, MP1
, N
46 C***FIRST EXECUTABLE STATEMENT DSCAL
48 IF (INCX
.EQ
. 1) GOTO 20
50 C Code for increment not equal to 1.
53 IF (INCX
.LT
. 0) IX
= (-N
+1)*INCX
+ 1
60 C Code for increment equal to 1.
62 C Clean-up loop so remaining vector length is a multiple of 5.