subroutine srotgf(sa,sb,c,s)
c
c construct givens plane rotation.
c jack dongarra, linpack, 3/11/78.
c
real sa,sb,c,s,roe,scale,r,z
c
roe = sb
if( abs(sa) .gt. abs(sb) ) roe = sa
scale = abs(sa) + abs(sb)
if( scale .ne. 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) .gt. abs(sb) ) z = s
if( abs(sb) .ge. abs(sa) .and. c .ne. 0.0 ) z = 1.0/c
20 sa = r
sb = z
return
end