NLSL
dcopy.f90
Go to the documentation of this file.
1  subroutine dcopy(n,dx,incx,dy,incy)
2 c
3 c copies a vector, x, to a vector, y.
4 c uses unrolled loops for increments equal to one.
5 c jack dongarra, linpack, 3/11/78.
6 c
7  double precision dx(1),dy(1)
8  integer i,incx,incy,ix,iy,m,mp1,n
9 c
10  if(n.le.0)return
11  if(incx.eq.1.and.incy.eq.1)go to 20
12 c
13 c code for unequal increments or equal increments
14 c not equal to 1
15 c
16  ix = 1
17  iy = 1
18  if(incx.lt.0)ix = (-n+1)*incx + 1
19  if(incy.lt.0)iy = (-n+1)*incy + 1
20  do 10 i = 1,n
21  dy(iy) = dx(ix)
22  ix = ix + incx
23  iy = iy + incy
24  10 continue
25  return
26 c
27 c code for both increments equal to 1
28 c
29 c
30 c clean-up loop
31 c
32  20 m = mod(n,7)
33  if( m .eq. 0 ) go to 40
34  do 30 i = 1,m
35  dy(i) = dx(i)
36  30 continue
37  if( n .lt. 7 ) return
38  40 mp1 = m + 1
39  do 50 i = mp1,n,7
40  dy(i) = dx(i)
41  dy(i + 1) = dx(i + 1)
42  dy(i + 2) = dx(i + 2)
43  dy(i + 3) = dx(i + 3)
44  dy(i + 4) = dx(i + 4)
45  dy(i + 5) = dx(i + 5)
46  dy(i + 6) = dx(i + 6)
47  50 continue
48  return
49  end
subroutine dcopy(n, dx, incx, dy, incy)
Definition: dcopy.f90:2