KTH framework for Nek5000 toolboxes; testing version  0.0.1
daxpy.f
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 modified 12/3/93, array(1) declarations changed to array(*)
7 c
8  double precision dx(*),dy(*),da
9  integer i,incx,incy,ix,iy,m,mp1,n
10 c
11  if(n.le.0)return
12  if (da .eq. 0.0d0) return
13  if(incx.eq.1.and.incy.eq.1)go to 20
14 c
15 c code for unequal increments or equal increments
16 c not equal to 1
17 c
18  ix = 1
19  iy = 1
20  if(incx.lt.0)ix = (-n+1)*incx + 1
21  if(incy.lt.0)iy = (-n+1)*incy + 1
22  do 10 i = 1,n
23  dy(iy) = dy(iy) + da*dx(ix)
24  ix = ix + incx
25  iy = iy + incy
26  10 continue
27  return
28 c
29 c code for both increments equal to 1
30 c
31 c
32 c clean-up loop
33 c
34  20 m = mod(n,4)
35  if( m .eq. 0 ) go to 40
36  do 30 i = 1,m
37  dy(i) = dy(i) + da*dx(i)
38  30 continue
39  if( n .lt. 4 ) return
40  40 mp1 = m + 1
41  do 50 i = mp1,n,4
42  dy(i) = dy(i) + da*dx(i)
43  dy(i + 1) = dy(i + 1) + da*dx(i + 1)
44  dy(i + 2) = dy(i + 2) + da*dx(i + 2)
45  dy(i + 3) = dy(i + 3) + da*dx(i + 3)
46  50 continue
47  return
48  end
subroutine daxpy(n, da, dx, incx, dy, incy)
Definition: daxpy.f:2