Blame thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/reference/sdotf.f
|
kusano |
2b45e8 |
real function sdotf(n,sx,incx,sy,incy)
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
c forms the dot product of two vectors.
|
|
kusano |
2b45e8 |
c uses unrolled loops for increments equal to one.
|
|
kusano |
2b45e8 |
c jack dongarra, linpack, 3/11/78.
|
|
kusano |
2b45e8 |
c modified 12/3/93, array(1) declarations changed to array(*)
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
real sx(*),sy(*),stemp
|
|
kusano |
2b45e8 |
integer i,incx,incy,ix,iy,m,mp1,n
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
stemp = 0.0e0
|
|
kusano |
2b45e8 |
sdotf = 0.0e0
|
|
kusano |
2b45e8 |
if(n.le.0)return
|
|
kusano |
2b45e8 |
if(incx.eq.1.and.incy.eq.1)go to 20
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
c code for unequal increments or equal increments
|
|
kusano |
2b45e8 |
c not equal to 1
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
ix = 1
|
|
kusano |
2b45e8 |
iy = 1
|
|
kusano |
2b45e8 |
if(incx.lt.0)ix = (-n+1)*incx + 1
|
|
kusano |
2b45e8 |
if(incy.lt.0)iy = (-n+1)*incy + 1
|
|
kusano |
2b45e8 |
do 10 i = 1,n
|
|
kusano |
2b45e8 |
stemp = stemp + sx(ix)*sy(iy)
|
|
kusano |
2b45e8 |
ix = ix + incx
|
|
kusano |
2b45e8 |
iy = iy + incy
|
|
kusano |
2b45e8 |
10 continue
|
|
kusano |
2b45e8 |
sdotf = stemp
|
|
kusano |
2b45e8 |
return
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
c code for both increments equal to 1
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
c clean-up loop
|
|
kusano |
2b45e8 |
c
|
|
kusano |
2b45e8 |
20 m = mod(n,5)
|
|
kusano |
2b45e8 |
if( m .eq. 0 ) go to 40
|
|
kusano |
2b45e8 |
do 30 i = 1,m
|
|
kusano |
2b45e8 |
stemp = stemp + sx(i)*sy(i)
|
|
kusano |
2b45e8 |
30 continue
|
|
kusano |
2b45e8 |
if( n .lt. 5 ) go to 60
|
|
kusano |
2b45e8 |
40 mp1 = m + 1
|
|
kusano |
2b45e8 |
do 50 i = mp1,n,5
|
|
kusano |
2b45e8 |
stemp = stemp + sx(i)*sy(i) + sx(i + 1)*sy(i + 1) +
|
|
kusano |
2b45e8 |
* sx(i + 2)*sy(i + 2) + sx(i + 3)*sy(i + 3) + sx(i + 4)*sy(i + 4)
|
|
kusano |
2b45e8 |
50 continue
|
|
kusano |
2b45e8 |
60 sdotf = stemp
|
|
kusano |
2b45e8 |
return
|
|
kusano |
2b45e8 |
end
|