NLSL: daxpy.f90 Source File

NLSL

- Main Page
- Modules
- Data Types List
- Files

- File List
- File Members

daxpy.f90
Go to the documentation of this file.
1 subroutine daxpy(n,da,dx,incx,dy,incy)
2 c
3 c constant times a vector plus a vector.
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),da
8 integer i,incx,incy,ix,iy,m,mp1,n
9 c
10 if(n.le.0)return
11 if (da .eq. 0.0d0) return
12 if(incx.eq.1.and.incy.eq.1)go to 20
13 c
14 c code for unequal increments or equal increments
15 c not equal 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 dy(iy) = dy(iy) + da*dx(ix)
23 ix = ix + incx
24 iy = iy + incy
25 10 continue
26 return
27 c
28 c code for both increments equal to 1
29 c
30 c
31 c clean-up loop
32 c
33 20 m = mod(n,4)
34 if( m .eq. 0 ) go to 40
35 do 30 i = 1,m
36 dy(i) = dy(i) + da*dx(i)
37 30 continue
38 if( n .lt. 4 ) return
39 40 mp1 = m + 1
40 do 50 i = mp1,n,4
41 dy(i) = dy(i) + da*dx(i)
42 dy(i + 1) = dy(i + 1) + da*dx(i + 1)
43 dy(i + 2) = dy(i + 2) + da*dx(i + 2)
44 dy(i + 3) = dy(i + 3) + da*dx(i + 3)
45 50 continue
46 return
47 end
daxpy
subroutine daxpy(n, da, dx, incx, dy, incy)
Definition: daxpy.f90:2