BLAS / srotg.f

Fortran project BLAS, source module srotg.f.

Source module last modified on Thu, 2 Jul 1998, 23:17;
HTML image of Fortran source automatically generated by for2html on Sun, 23 Jun 2002, 15:10.


      subroutine srotg(sa,sb,c,s)
#
#     construct givens plane rotation.
#     jack dongarra, linpack, 3/11/78.
#
      real sa,sb,c,s,roe,scale,r,z
#
      roe = sb
      if( abs(sa) > abs(sb) ) roe = sa
      scale = abs(sa) + abs(sb)
      if( scale != 0.0 ) go to 10
         c = 1.0
         s = 0.0
         r = 0.0
         z = 0.0
         go to 20
   10 r = scale*sqrt((sa/scale)**2 + (sb/scale)**2)
      r = sign(1.0,roe)*r
      c = sa/r
      s = sb/r
      z = 1.0
      if( abs(sa) > abs(sb) ) z = s
      if( abs(sb) >= abs(sa) && c != 0.0 ) z = 1.0/c
   20 sa = r
      sb = z
      return
      end