LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dscal()

subroutine dscal ( integer  n,
double precision  da,
double precision, dimension(*)  dx,
integer  incx 
)

DSCAL

Purpose:
    DSCAL scales a vector by a constant.
    uses unrolled loops for increment equal to 1.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]DA
          DA is DOUBLE PRECISION
           On entry, DA specifies the scalar alpha.
[in,out]DX
          DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of DX
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 3/93 to return if incx .le. 0.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 78 of file dscal.f.

79*
80* -- Reference BLAS level1 routine --
81* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
82* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
83*
84* .. Scalar Arguments ..
85 DOUBLE PRECISION DA
86 INTEGER INCX,N
87* ..
88* .. Array Arguments ..
89 DOUBLE PRECISION DX(*)
90* ..
91*
92* =====================================================================
93*
94* .. Local Scalars ..
95 INTEGER I,M,MP1,NINCX
96* .. Parameters ..
97 DOUBLE PRECISION ONE
98 parameter(one=1.0d+0)
99* ..
100* .. Intrinsic Functions ..
101 INTRINSIC mod
102* ..
103 IF (n.LE.0 .OR. incx.LE.0 .OR. da.EQ.one) 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*
137* End of DSCAL
138*