LAPACK  3.9.0
LAPACK: Linear Algebra PACKage
dscal.f
Go to the documentation of this file.
1 *> \brief \b DSCAL
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE DSCAL(N,DA,DX,INCX)
12 *
13 * .. Scalar Arguments ..
14 * DOUBLE PRECISION DA
15 * INTEGER INCX,N
16 * ..
17 * .. Array Arguments ..
18 * DOUBLE PRECISION DX(*)
19 * ..
20 *
21 *
22 *> \par Purpose:
23 * =============
24 *>
25 *> \verbatim
26 *>
27 *> DSCAL scales a vector by a constant.
28 *> uses unrolled loops for increment equal to 1.
29 *> \endverbatim
30 *
31 * Arguments:
32 * ==========
33 *
34 *> \param[in] N
35 *> \verbatim
36 *> N is INTEGER
37 *> number of elements in input vector(s)
38 *> \endverbatim
39 *>
40 *> \param[in] DA
41 *> \verbatim
42 *> DA is DOUBLE PRECISION
43 *> On entry, DA specifies the scalar alpha.
44 *> \endverbatim
45 *>
46 *> \param[in,out] DX
47 *> \verbatim
48 *> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
49 *> \endverbatim
50 *>
51 *> \param[in] INCX
52 *> \verbatim
53 *> INCX is INTEGER
54 *> storage spacing between elements of DX
55 *> \endverbatim
56 *
57 * Authors:
58 * ========
59 *
60 *> \author Univ. of Tennessee
61 *> \author Univ. of California Berkeley
62 *> \author Univ. of Colorado Denver
63 *> \author NAG Ltd.
64 *
65 *> \date November 2017
66 *
67 *> \ingroup double_blas_level1
68 *
69 *> \par Further Details:
70 * =====================
71 *>
72 *> \verbatim
73 *>
74 *> jack dongarra, linpack, 3/11/78.
75 *> modified 3/93 to return if incx .le. 0.
76 *> modified 12/3/93, array(1) declarations changed to array(*)
77 *> \endverbatim
78 *>
79 * =====================================================================
80  SUBROUTINE dscal(N,DA,DX,INCX)
81 *
82 * -- Reference BLAS level1 routine (version 3.8.0) --
83 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
84 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
85 * November 2017
86 *
87 * .. Scalar Arguments ..
88  DOUBLE PRECISION DA
89  INTEGER INCX,N
90 * ..
91 * .. Array Arguments ..
92  DOUBLE PRECISION DX(*)
93 * ..
94 *
95 * =====================================================================
96 *
97 * .. Local Scalars ..
98  INTEGER I,M,MP1,NINCX
99 * ..
100 * .. Intrinsic Functions ..
101  INTRINSIC mod
102 * ..
103  IF (n.LE.0 .OR. incx.LE.0) RETURN
104  IF (incx.EQ.1) THEN
105 *
106 * code for increment equal to 1
107 *
108 *
109 * clean-up loop
110 *
111  m = mod(n,5)
112  IF (m.NE.0) THEN
113  DO i = 1,m
114  dx(i) = da*dx(i)
115  END DO
116  IF (n.LT.5) RETURN
117  END IF
118  mp1 = m + 1
119  DO i = mp1,n,5
120  dx(i) = da*dx(i)
121  dx(i+1) = da*dx(i+1)
122  dx(i+2) = da*dx(i+2)
123  dx(i+3) = da*dx(i+3)
124  dx(i+4) = da*dx(i+4)
125  END DO
126  ELSE
127 *
128 * code for increment not equal to 1
129 *
130  nincx = n*incx
131  DO i = 1,nincx,incx
132  dx(i) = da*dx(i)
133  END DO
134  END IF
135  RETURN
136  END
dscal
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:81