LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ sscal()

subroutine sscal ( integer  N,
real  SA,
real, dimension(*)  SX,
integer  INCX 
)

SSCAL

Purpose:
    SSCAL 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]SA
          SA is REAL
           On entry, SA specifies the scalar alpha.
[in,out]SX
          SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of SX
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
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 81 of file sscal.f.

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  REAL sa
89  INTEGER incx,n
90 * ..
91 * .. Array Arguments ..
92  REAL sx(*)
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  sx(i) = sa*sx(i)
115  END DO
116  IF (n.LT.5) RETURN
117  END IF
118  mp1 = m + 1
119  DO i = mp1,n,5
120  sx(i) = sa*sx(i)
121  sx(i+1) = sa*sx(i+1)
122  sx(i+2) = sa*sx(i+2)
123  sx(i+3) = sa*sx(i+3)
124  sx(i+4) = sa*sx(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  sx(i) = sa*sx(i)
133  END DO
134  END IF
135  RETURN