kusano 2b45e8
      subroutine drotgf(da,db,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
      double precision da,db,c,s,roe,scale,r,z
kusano 2b45e8
c
kusano 2b45e8
      roe = db
kusano 2b45e8
      if( dabs(da) .gt. dabs(db) ) roe = da
kusano 2b45e8
      scale = dabs(da) + dabs(db)
kusano 2b45e8
      if( scale .ne. 0.0d0 ) go to 10
kusano 2b45e8
         c = 1.0d0
kusano 2b45e8
         s = 0.0d0
kusano 2b45e8
         r = 0.0d0
kusano 2b45e8
         z = 0.0d0
kusano 2b45e8
         go to 20
kusano 2b45e8
   10 r = scale*dsqrt((da/scale)**2 + (db/scale)**2)
kusano 2b45e8
      r = dsign(1.0d0,roe)*r
kusano 2b45e8
      c = da/r
kusano 2b45e8
      s = db/r
kusano 2b45e8
      z = 1.0d0
kusano 2b45e8
      if( dabs(da) .gt. dabs(db) ) z = s
kusano 2b45e8
      if( dabs(db) .ge. dabs(da) .and. c .ne. 0.0d0 ) z = 1.0d0/c
kusano 2b45e8
   20 da = r
kusano 2b45e8
      db = z
kusano 2b45e8
      return
kusano 2b45e8
      end