kusano 2b45e8
      subroutine srotgf(sa,sb,c,s)
kusano 2b45e8
c
kusano 2b45e8
c     construct givens plane rotation.
kusano 2b45e8
c     jack dongarra, linpack, 3/11/78.
kusano 2b45e8
c
kusano 2b45e8
      real sa,sb,c,s,roe,scale,r,z
kusano 2b45e8
c
kusano 2b45e8
      roe = sb
kusano 2b45e8
      if( abs(sa) .gt. abs(sb) ) roe = sa
kusano 2b45e8
      scale = abs(sa) + abs(sb)
kusano 2b45e8
      if( scale .ne. 0.0 ) go to 10
kusano 2b45e8
         c = 1.0
kusano 2b45e8
         s = 0.0
kusano 2b45e8
         r = 0.0
kusano 2b45e8
         z = 0.0
kusano 2b45e8
         go to 20
kusano 2b45e8
   10 r = scale*sqrt((sa/scale)**2 + (sb/scale)**2)
kusano 2b45e8
      r = sign(1.0,roe)*r
kusano 2b45e8
      c = sa/r
kusano 2b45e8
      s = sb/r
kusano 2b45e8
      z = 1.0
kusano 2b45e8
      if( abs(sa) .gt. abs(sb) ) z = s
kusano 2b45e8
      if( abs(sb) .ge. abs(sa) .and. c .ne. 0.0 ) z = 1.0/c
kusano 2b45e8
   20 sa = r
kusano 2b45e8
      sb = z
kusano 2b45e8
      return
kusano 2b45e8
      end