|
|
1.1 root 1: subroutine sscal(n,sa,sx,incx)
2: c
3: c scales a vector by a constant.
4: c uses unrolled loops for increment equal to 1.
5: c jack dongarra, linpack, 3/11/78.
6: c
7: real sa,sx(1)
8: integer i,incx,m,mp1,n,nincx
9: c
10: if(n.le.0)return
11: if(incx.eq.1)go to 20
12: c
13: c code for increment not equal to 1
14: c
15: nincx = n*incx
16: do 10 i = 1,nincx,incx
17: sx(i) = sa*sx(i)
18: 10 continue
19: return
20: c
21: c code for increment equal to 1
22: c
23: c
24: c clean-up loop
25: c
26: 20 m = mod(n,5)
27: if( m .eq. 0 ) go to 40
28: do 30 i = 1,m
29: sx(i) = sa*sx(i)
30: 30 continue
31: if( n .lt. 5 ) return
32: 40 mp1 = m + 1
33: do 50 i = mp1,n,5
34: sx(i) = sa*sx(i)
35: sx(i + 1) = sa*sx(i + 1)
36: sx(i + 2) = sa*sx(i + 2)
37: sx(i + 3) = sa*sx(i + 3)
38: sx(i + 4) = sa*sx(i + 4)
39: 50 continue
40: return
41: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.