Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/blas/dswap.f

raw
1 subroutine dswap (n,dx,incx,dy,incy)
2 c
3 c interchanges two vectors.
4 c uses unrolled loops for increments equal one.
5 c jack dongarra, linpack, 3/11/78.
6 c modified 12/3/93, array(1) declarations changed to array(*)
7 c
8 double precision dx(*),dy(*),dtemp
9 integer i,incx,incy,ix,iy,m,mp1,n
10 c
11 if(n.le.0)return
12 if(incx.eq.1.and.incy.eq.1)go to 20
13 c
14 c code for unequal increments or equal increments not equal
15 c to 1
16 c
17 ix = 1
18 iy = 1
19 if(incx.lt.0)ix = (-n+1)*incx + 1
20 if(incy.lt.0)iy = (-n+1)*incy + 1
21 do 10 i = 1,n
22 dtemp = dx(ix)
23 dx(ix) = dy(iy)
24 dy(iy) = dtemp
25 ix = ix + incx
26 iy = iy + incy
27 10 continue
28 return
29 c
30 c code for both increments equal to 1
31 c
32 c
33 c clean-up loop
34 c
35 20 m = mod(n,3)
36 if( m .eq. 0 ) go to 40
37 do 30 i = 1,m
38 dtemp = dx(i)
39 dx(i) = dy(i)
40 dy(i) = dtemp
41 30 continue
42 if( n .lt. 3 ) return
43 40 mp1 = m + 1
44 do 50 i = mp1,n,3
45 dtemp = dx(i)
46 dx(i) = dy(i)
47 dy(i) = dtemp
48 dtemp = dx(i + 1)
49 dx(i + 1) = dy(i + 1)
50 dy(i + 1) = dtemp
51 dtemp = dx(i + 2)
52 dx(i + 2) = dy(i + 2)
53 dy(i + 2) = dtemp
54 50 continue
55 return
56 end