LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
 All Classes Files Functions Variables Typedefs Macros
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 *> scales a vector by a constant.
28 *> uses unrolled loops for increment equal to 1.
29 *> \endverbatim
30 *
31 * Authors:
32 * ========
33 *
34 *> \author Univ. of Tennessee
35 *> \author Univ. of California Berkeley
36 *> \author Univ. of Colorado Denver
37 *> \author NAG Ltd.
38 *
39 *> \date November 2011
40 *
41 *> \ingroup single_blas_level1
42 *
43 *> \par Further Details:
44 * =====================
45 *>
46 *> \verbatim
47 *>
48 *> jack dongarra, linpack, 3/11/78.
49 *> modified 3/93 to return if incx .le. 0.
50 *> modified 12/3/93, array(1) declarations changed to array(*)
51 *> \endverbatim
52 *>
53 * =====================================================================
54  SUBROUTINE sscal(N,SA,SX,INCX)
55 *
56 * -- Reference BLAS level1 routine (version 3.4.0) --
57 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
58 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
59 * November 2011
60 *
61 * .. Scalar Arguments ..
62  REAL sa
63  INTEGER incx,n
64 * ..
65 * .. Array Arguments ..
66  REAL sx(*)
67 * ..
68 *
69 * =====================================================================
70 *
71 * .. Local Scalars ..
72  INTEGER i,m,mp1,nincx
73 * ..
74 * .. Intrinsic Functions ..
75  INTRINSIC mod
76 * ..
77  IF (n.LE.0 .OR. incx.LE.0) RETURN
78  IF (incx.EQ.1) THEN
79 *
80 * code for increment equal to 1
81 *
82 *
83 * clean-up loop
84 *
85  m = mod(n,5)
86  IF (m.NE.0) THEN
87  DO i = 1,m
88  sx(i) = sa*sx(i)
89  END DO
90  IF (n.LT.5) RETURN
91  END IF
92  mp1 = m + 1
93  DO i = mp1,n,5
94  sx(i) = sa*sx(i)
95  sx(i+1) = sa*sx(i+1)
96  sx(i+2) = sa*sx(i+2)
97  sx(i+3) = sa*sx(i+3)
98  sx(i+4) = sa*sx(i+4)
99  END DO
100  ELSE
101 *
102 * code for increment not equal to 1
103 *
104  nincx = n*incx
105  DO i = 1,nincx,incx
106  sx(i) = sa*sx(i)
107  END DO
108  END IF
109  RETURN
110  END