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.
- 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 sscal.f.
79
80
81
82
83
84
85 REAL SA
86 INTEGER INCX,N
87
88
89 REAL SX(*)
90
91
92
93
94
95 INTEGER I,M,MP1,NINCX
96
97
98 REAL ONE
99 parameter(one=1.0e+0)
100
101
102 INTRINSIC mod
103
104 IF (n.LE.0 .OR. incx.LE.0 .OR. sa.EQ.one) RETURN
105 IF (incx.EQ.1) THEN
106
107
108
109
110
111
112 m = mod(n,5)
113 IF (m.NE.0) THEN
114 DO i = 1,m
115 sx(i) = sa*sx(i)
116 END DO
117 IF (n.LT.5) RETURN
118 END IF
119 mp1 = m + 1
120 DO i = mp1,n,5
121 sx(i) = sa*sx(i)
122 sx(i+1) = sa*sx(i+1)
123 sx(i+2) = sa*sx(i+2)
124 sx(i+3) = sa*sx(i+3)
125 sx(i+4) = sa*sx(i+4)
126 END DO
127 ELSE
128
129
130
131 nincx = n*incx
132 DO i = 1,nincx,incx
133 sx(i) = sa*sx(i)
134 END DO
135 END IF
136 RETURN
137
138
139