| 1 |
real function scasum(n,cx,incx) |
| 2 |
c |
| 3 |
c takes the sum of the absolute values of a complex vector and |
| 4 |
c returns a single precision result. |
| 5 |
c jack dongarra, linpack, 3/11/78. |
| 6 |
c modified 3/93 to return if incx .le. 0. |
| 7 |
c modified 12/3/93, array(1) declarations changed to array(*) |
| 8 |
c |
| 9 |
complex cx(*) |
| 10 |
real stemp |
| 11 |
integer i,incx,n,nincx |
| 12 |
c |
| 13 |
scasum = 0.0e0 |
| 14 |
stemp = 0.0e0 |
| 15 |
if( n.le.0 .or. incx.le.0 )return |
| 16 |
if(incx.eq.1)go to 20 |
| 17 |
c |
| 18 |
c code for increment not equal to 1 |
| 19 |
c |
| 20 |
nincx = n*incx |
| 21 |
do 10 i = 1,nincx,incx |
| 22 |
stemp = stemp + abs(real(cx(i))) + abs(aimag(cx(i))) |
| 23 |
10 continue |
| 24 |
scasum = stemp |
| 25 |
return |
| 26 |
c |
| 27 |
c code for increment equal to 1 |
| 28 |
c |
| 29 |
20 do 30 i = 1,n |
| 30 |
stemp = stemp + abs(real(cx(i))) + abs(aimag(cx(i))) |
| 31 |
30 continue |
| 32 |
scasum = stemp |
| 33 |
return |
| 34 |
end |