| 1 |
subroutine drotg(da,db,c,s) |
| 2 |
c |
| 3 |
c construct givens plane rotation. |
| 4 |
c jack dongarra, linpack, 3/11/78. |
| 5 |
c |
| 6 |
double precision da,db,c,s,roe,scale,r,z |
| 7 |
c |
| 8 |
roe = db |
| 9 |
if( dabs(da) .gt. dabs(db) ) roe = da |
| 10 |
scale = dabs(da) + dabs(db) |
| 11 |
if( scale .ne. 0.0d0 ) go to 10 |
| 12 |
c = 1.0d0 |
| 13 |
s = 0.0d0 |
| 14 |
r = 0.0d0 |
| 15 |
z = 0.0d0 |
| 16 |
go to 20 |
| 17 |
10 r = scale*dsqrt((da/scale)**2 + (db/scale)**2) |
| 18 |
r = dsign(1.0d0,roe)*r |
| 19 |
c = da/r |
| 20 |
s = db/r |
| 21 |
z = 1.0d0 |
| 22 |
if( dabs(da) .gt. dabs(db) ) z = s |
| 23 |
if( dabs(db) .ge. dabs(da) .and. c .ne. 0.0d0 ) z = 1.0d0/c |
| 24 |
20 da = r |
| 25 |
db = z |
| 26 |
return |
| 27 |
end |