You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

scasumf.f 872 B

12345678910111213141516171819202122232425262728293031323334
  1. real function scasumf(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. scasumf = 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. scasumf = 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. scasumf = stemp
  33. return
  34. end