LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
sscal.f
Go to the documentation of this file.
1 *> \brief \b SSCAL
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 SSCAL(N,SA,SX,INCX)
12 *
13 * .. Scalar Arguments ..
14 * REAL SA
15 * INTEGER INCX,N
16 * ..
17 * .. Array Arguments ..
18 * REAL SX(*)
19 * ..
20 *
21 *
22 *> \par Purpose:
23 * =============
24 *>
25 *> \verbatim
26 *>
27 *> SSCAL 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] SA
41 *> \verbatim
42 *> SA is REAL
43 *> On entry, SA specifies the scalar alpha.
44 *> \endverbatim
45 *>
46 *> \param[in,out] SX
47 *> \verbatim
48 *> SX is REAL 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 SX
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 *> \ingroup single_blas_level1
66 *
67 *> \par Further Details:
68 * =====================
69 *>
70 *> \verbatim
71 *>
72 *> jack dongarra, linpack, 3/11/78.
73 *> modified 3/93 to return if incx .le. 0.
74 *> modified 12/3/93, array(1) declarations changed to array(*)
75 *> \endverbatim
76 *>
77 * =====================================================================
78  SUBROUTINE sscal(N,SA,SX,INCX)
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  REAL SA
86  INTEGER INCX,N
87 * ..
88 * .. Array Arguments ..
89  REAL SX(*)
90 * ..
91 *
92 * =====================================================================
93 *
94 * .. Local Scalars ..
95  INTEGER I,M,MP1,NINCX
96 * ..
97 * .. Intrinsic Functions ..
98  INTRINSIC mod
99 * ..
100  IF (n.LE.0 .OR. incx.LE.0) RETURN
101  IF (incx.EQ.1) THEN
102 *
103 * code for increment equal to 1
104 *
105 *
106 * clean-up loop
107 *
108  m = mod(n,5)
109  IF (m.NE.0) THEN
110  DO i = 1,m
111  sx(i) = sa*sx(i)
112  END DO
113  IF (n.LT.5) RETURN
114  END IF
115  mp1 = m + 1
116  DO i = mp1,n,5
117  sx(i) = sa*sx(i)
118  sx(i+1) = sa*sx(i+1)
119  sx(i+2) = sa*sx(i+2)
120  sx(i+3) = sa*sx(i+3)
121  sx(i+4) = sa*sx(i+4)
122  END DO
123  ELSE
124 *
125 * code for increment not equal to 1
126 *
127  nincx = n*incx
128  DO i = 1,nincx,incx
129  sx(i) = sa*sx(i)
130  END DO
131  END IF
132  RETURN
133 *
134 * End of SSCAL
135 *
136  END
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:79