LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
 All Classes Files Functions Variables Typedefs Macros
icopy.f
Go to the documentation of this file.
1 *> \brief \b ICOPY
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 ICOPY( N, SX, INCX, SY, INCY )
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX, INCY, N
15 * ..
16 * .. Array Arguments ..
17 * INTEGER SX( * ), SY( * )
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> ICOPY copies an integer vector x to an integer vector y.
27 *> Uses unrolled loops for increments equal to 1.
28 *> \endverbatim
29 *
30 * Arguments:
31 * ==========
32 *
33 *> \param[in] N
34 *> \verbatim
35 *> N is INTEGER
36 *> The length of the vectors SX and SY.
37 *> \endverbatim
38 *>
39 *> \param[in] SX
40 *> \verbatim
41 *> SX is INTEGER array, dimension (1+(N-1)*abs(INCX))
42 *> The vector X.
43 *> \endverbatim
44 *>
45 *> \param[in] INCX
46 *> \verbatim
47 *> INCX is INTEGER
48 *> The spacing between consecutive elements of SX.
49 *> \endverbatim
50 *>
51 *> \param[out] SY
52 *> \verbatim
53 *> SY is INTEGER array, dimension (1+(N-1)*abs(INCY))
54 *> The vector Y.
55 *> \endverbatim
56 *>
57 *> \param[in] INCY
58 *> \verbatim
59 *> INCY is INTEGER
60 *> The spacing between consecutive elements of SY.
61 *> \endverbatim
62 *
63 * Authors:
64 * ========
65 *
66 *> \author Univ. of Tennessee
67 *> \author Univ. of California Berkeley
68 *> \author Univ. of Colorado Denver
69 *> \author NAG Ltd.
70 *
71 *> \date November 2011
72 *
73 *> \ingroup aux_lin
74 *
75 * =====================================================================
76  SUBROUTINE icopy( N, SX, INCX, SY, INCY )
77 *
78 * -- LAPACK test routine (version 3.4.0) --
79 * -- LAPACK is a software package provided by Univ. of Tennessee, --
80 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
81 * November 2011
82 *
83 * .. Scalar Arguments ..
84  INTEGER incx, incy, n
85 * ..
86 * .. Array Arguments ..
87  INTEGER sx( * ), sy( * )
88 * ..
89 *
90 * =====================================================================
91 *
92 * .. Local Scalars ..
93  INTEGER i, ix, iy, m, mp1
94 * ..
95 * .. Intrinsic Functions ..
96  INTRINSIC mod
97 * ..
98 * .. Executable Statements ..
99 *
100  IF( n.LE.0 )
101  $ RETURN
102  IF( incx.EQ.1 .AND. incy.EQ.1 )
103  $ go to 20
104 *
105 * Code for unequal increments or equal increments not equal to 1
106 *
107  ix = 1
108  iy = 1
109  IF( incx.LT.0 )
110  $ ix = ( -n+1 )*incx + 1
111  IF( incy.LT.0 )
112  $ iy = ( -n+1 )*incy + 1
113  DO 10 i = 1, n
114  sy( iy ) = sx( ix )
115  ix = ix + incx
116  iy = iy + incy
117  10 CONTINUE
118  RETURN
119 *
120 * Code for both increments equal to 1
121 *
122 * Clean-up loop
123 *
124  20 CONTINUE
125  m = mod( n, 7 )
126  IF( m.EQ.0 )
127  $ go to 40
128  DO 30 i = 1, m
129  sy( i ) = sx( i )
130  30 CONTINUE
131  IF( n.LT.7 )
132  $ RETURN
133  40 CONTINUE
134  mp1 = m + 1
135  DO 50 i = mp1, n, 7
136  sy( i ) = sx( i )
137  sy( i+1 ) = sx( i+1 )
138  sy( i+2 ) = sx( i+2 )
139  sy( i+3 ) = sx( i+3 )
140  sy( i+4 ) = sx( i+4 )
141  sy( i+5 ) = sx( i+5 )
142  sy( i+6 ) = sx( i+6 )
143  50 CONTINUE
144  RETURN
145 *
146 * End of ICOPY
147 *
148  END