kusano 2b45e8
      real function sasumf(n,sx,incx)
kusano 2b45e8
c
kusano 2b45e8
c     takes the sum of the absolute values.
kusano 2b45e8
c     uses unrolled loops for increment equal to one.
kusano 2b45e8
c     jack dongarra, linpack, 3/11/78.
kusano 2b45e8
c     modified 3/93 to return if incx .le. 0.
kusano 2b45e8
c     modified 12/3/93, array(1) declarations changed to array(*)
kusano 2b45e8
c
kusano 2b45e8
      real sx(*),stemp
kusano 2b45e8
      integer i,incx,m,mp1,n,nincx
kusano 2b45e8
c
kusano 2b45e8
      sasumf = 0.0e0
kusano 2b45e8
      stemp = 0.0e0
kusano 2b45e8
      if( n.le.0 .or. incx.le.0 )return
kusano 2b45e8
      if(incx.eq.1)go to 20
kusano 2b45e8
c
kusano 2b45e8
c        code for increment not equal to 1
kusano 2b45e8
c
kusano 2b45e8
      nincx = n*incx
kusano 2b45e8
      do 10 i = 1,nincx,incx
kusano 2b45e8
        stemp = stemp + abs(sx(i))
kusano 2b45e8
   10 continue
kusano 2b45e8
      sasumf = stemp
kusano 2b45e8
      return
kusano 2b45e8
c
kusano 2b45e8
c        code for increment equal to 1
kusano 2b45e8
c
kusano 2b45e8
c
kusano 2b45e8
c        clean-up loop
kusano 2b45e8
c
kusano 2b45e8
   20 m = mod(n,6)
kusano 2b45e8
      if( m .eq. 0 ) go to 40
kusano 2b45e8
      do 30 i = 1,m
kusano 2b45e8
        stemp = stemp + abs(sx(i))
kusano 2b45e8
   30 continue
kusano 2b45e8
      if( n .lt. 6 ) go to 60
kusano 2b45e8
   40 mp1 = m + 1
kusano 2b45e8
      do 50 i = mp1,n,6
kusano 2b45e8
        stemp = stemp + abs(sx(i)) + abs(sx(i + 1)) + abs(sx(i + 2))
kusano 2b45e8
     *  + abs(sx(i + 3)) + abs(sx(i + 4)) + abs(sx(i + 5))
kusano 2b45e8
   50 continue
kusano 2b45e8
   60 sasumf = stemp
kusano 2b45e8
      return
kusano 2b45e8
      end