Forgot to load lapack in a few examples
[maxima.git] / share / odepack / fortran / dscal.f
blob8d893c747026777112d20a8285c01e075cd6831c
1 *DECK DSCAL
2 SUBROUTINE DSCAL (N, DA, DX, INCX)
3 C***BEGIN PROLOGUE DSCAL
4 C***PURPOSE Multiply a vector by a constant.
5 C***CATEGORY D1A6
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)
11 C Krogh, F. T., (JPL)
12 C***DESCRIPTION
14 C B L A S Subprogram
15 C Description of Parameters
17 C --Input--
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
23 C --Output--
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)
36 C 791001 DATE WRITTEN
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.
41 C (WRB)
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
47 IF (N .LE. 0) RETURN
48 IF (INCX .EQ. 1) GOTO 20
50 C Code for increment not equal to 1.
52 IX = 1
53 IF (INCX .LT. 0) IX = (-N+1)*INCX + 1
54 DO 10 I = 1,N
55 DX(IX) = DA*DX(IX)
56 IX = IX + INCX
57 10 CONTINUE
58 RETURN
60 C Code for increment equal to 1.
62 C Clean-up loop so remaining vector length is a multiple of 5.
64 20 M = MOD(N,5)
65 IF (M .EQ. 0) GOTO 40
66 DO 30 I = 1,M
67 DX(I) = DA*DX(I)
68 30 CONTINUE
69 IF (N .LT. 5) RETURN
70 40 MP1 = M + 1
71 DO 50 I = MP1,N,5
72 DX(I) = DA*DX(I)
73 DX(I+1) = DA*DX(I+1)
74 DX(I+2) = DA*DX(I+2)
75 DX(I+3) = DA*DX(I+3)
76 DX(I+4) = DA*DX(I+4)
77 50 CONTINUE
78 RETURN
79 END