LAPACK  3.10.1
LAPACK: Linear Algebra PACKage
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 *> \ingroup aux_lin
72 *
73 * =====================================================================
74  SUBROUTINE icopy( N, SX, INCX, SY, INCY )
75 *
76 * -- LAPACK test routine --
77 * -- LAPACK is a software package provided by Univ. of Tennessee, --
78 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
79 *
80 * .. Scalar Arguments ..
81  INTEGER INCX, INCY, N
82 * ..
83 * .. Array Arguments ..
84  INTEGER SX( * ), SY( * )
85 * ..
86 *
87 * =====================================================================
88 *
89 * .. Local Scalars ..
90  INTEGER I, IX, IY, M, MP1
91 * ..
92 * .. Intrinsic Functions ..
93  INTRINSIC mod
94 * ..
95 * .. Executable Statements ..
96 *
97  IF( n.LE.0 )
98  $ RETURN
99  IF( incx.EQ.1 .AND. incy.EQ.1 )
100  $ GO TO 20
101 *
102 * Code for unequal increments or equal increments not equal to 1
103 *
104  ix = 1
105  iy = 1
106  IF( incx.LT.0 )
107  $ ix = ( -n+1 )*incx + 1
108  IF( incy.LT.0 )
109  $ iy = ( -n+1 )*incy + 1
110  DO 10 i = 1, n
111  sy( iy ) = sx( ix )
112  ix = ix + incx
113  iy = iy + incy
114  10 CONTINUE
115  RETURN
116 *
117 * Code for both increments equal to 1
118 *
119 * Clean-up loop
120 *
121  20 CONTINUE
122  m = mod( n, 7 )
123  IF( m.EQ.0 )
124  $ GO TO 40
125  DO 30 i = 1, m
126  sy( i ) = sx( i )
127  30 CONTINUE
128  IF( n.LT.7 )
129  $ RETURN
130  40 CONTINUE
131  mp1 = m + 1
132  DO 50 i = mp1, n, 7
133  sy( i ) = sx( i )
134  sy( i+1 ) = sx( i+1 )
135  sy( i+2 ) = sx( i+2 )
136  sy( i+3 ) = sx( i+3 )
137  sy( i+4 ) = sx( i+4 )
138  sy( i+5 ) = sx( i+5 )
139  sy( i+6 ) = sx( i+6 )
140  50 CONTINUE
141  RETURN
142 *
143 * End of ICOPY
144 *
145  END
subroutine icopy(N, SX, INCX, SY, INCY)
ICOPY
Definition: icopy.f:75