LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
dcopy.f
Go to the documentation of this file.
1 *> \brief \b DCOPY
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 DCOPY(N,DX,INCX,DY,INCY)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,INCY,N
15 * ..
16 * .. Array Arguments ..
17 * DOUBLE PRECISION DX(*),DY(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> DCOPY copies a vector, x, to a 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 *> number of elements in input vector(s)
37 *> \endverbatim
38 *>
39 *> \param[in] DX
40 *> \verbatim
41 *> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
42 *> \endverbatim
43 *>
44 *> \param[in] INCX
45 *> \verbatim
46 *> INCX is INTEGER
47 *> storage spacing between elements of DX
48 *> \endverbatim
49 *>
50 *> \param[out] DY
51 *> \verbatim
52 *> DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
53 *> \endverbatim
54 *>
55 *> \param[in] INCY
56 *> \verbatim
57 *> INCY is INTEGER
58 *> storage spacing between elements of DY
59 *> \endverbatim
60 *
61 * Authors:
62 * ========
63 *
64 *> \author Univ. of Tennessee
65 *> \author Univ. of California Berkeley
66 *> \author Univ. of Colorado Denver
67 *> \author NAG Ltd.
68 *
69 *> \ingroup double_blas_level1
70 *
71 *> \par Further Details:
72 * =====================
73 *>
74 *> \verbatim
75 *>
76 *> jack dongarra, linpack, 3/11/78.
77 *> modified 12/3/93, array(1) declarations changed to array(*)
78 *> \endverbatim
79 *>
80 * =====================================================================
81  SUBROUTINE dcopy(N,DX,INCX,DY,INCY)
82 *
83 * -- Reference BLAS level1 routine --
84 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
85 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
86 *
87 * .. Scalar Arguments ..
88  INTEGER INCX,INCY,N
89 * ..
90 * .. Array Arguments ..
91  DOUBLE PRECISION DX(*),DY(*)
92 * ..
93 *
94 * =====================================================================
95 *
96 * .. Local Scalars ..
97  INTEGER I,IX,IY,M,MP1
98 * ..
99 * .. Intrinsic Functions ..
100  INTRINSIC mod
101 * ..
102  IF (n.LE.0) RETURN
103  IF (incx.EQ.1 .AND. incy.EQ.1) THEN
104 *
105 * code for both increments equal to 1
106 *
107 *
108 * clean-up loop
109 *
110  m = mod(n,7)
111  IF (m.NE.0) THEN
112  DO i = 1,m
113  dy(i) = dx(i)
114  END DO
115  IF (n.LT.7) RETURN
116  END IF
117  mp1 = m + 1
118  DO i = mp1,n,7
119  dy(i) = dx(i)
120  dy(i+1) = dx(i+1)
121  dy(i+2) = dx(i+2)
122  dy(i+3) = dx(i+3)
123  dy(i+4) = dx(i+4)
124  dy(i+5) = dx(i+5)
125  dy(i+6) = dx(i+6)
126  END DO
127  ELSE
128 *
129 * code for unequal increments or equal increments
130 * not equal to 1
131 *
132  ix = 1
133  iy = 1
134  IF (incx.LT.0) ix = (-n+1)*incx + 1
135  IF (incy.LT.0) iy = (-n+1)*incy + 1
136  DO i = 1,n
137  dy(iy) = dx(ix)
138  ix = ix + incx
139  iy = iy + incy
140  END DO
141  END IF
142  RETURN
143  END
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:82