      SUBROUTINE G1 (A,B,COS,SIN,SIG)                                   G1000100
C     C.L.LAWSON AND R.J.HANSON, JET PROPULSION LABORATORY, 1973 JUN 12 G1000200
C     TO APPEAR IN 'SOLVING LEAST SQUARES PROBLEMS', PRENTICE-HALL, 1974G1000300
C                                                                       G1000400
C                                                                       G1000500
C     COMPUTE ORTHOGONAL ROTATION MATRIX..                              G1000600
C     COMPUTE.. MATRIX   (C, S) SO THAT (C, S)(A) = (SQRT(A**2+B**2))   G1000700
C                        (-S,C)         (-S,C)(B)   (   0          )    G1000800
C     COMPUTE SIG = SQRT(A**2+B**2)                                     G1000900
C        SIG IS COMPUTED LAST TO ALLOW FOR THE POSSIBILITY THAT         G1001000
C        SIG MAY BE IN THE SAME LOCATION AS A OR B .                    G1001100
C                                                                       G1001200
      ZERO=0.                                                           G1001300
      ONE=1.                                                            G1001400
      IF (ABS(A).LE.ABS(B)) GO TO 10                                    G1001500
      XR=B/A                                                            G1001600
      YR=SQRT(ONE+XR**2)                                                G1001700
      COS=SIGN(ONE/YR,A)                                                G1001800
      SIN=COS*XR                                                        G1001900
      SIG=ABS(A)*YR                                                     G1002000
      RETURN                                                            G1002100
   10 IF (B) 20,30,20                                                   G1002200
   20 XR=A/B                                                            G1002300
      YR=SQRT(ONE+XR**2)                                                G1002400
      SIN=SIGN(ONE/YR,B)                                                G1002500
      COS=SIN*XR                                                        G1002600
      SIG=ABS(B)*YR                                                     G1002700
      RETURN                                                            G1002800
   30 SIG=ZERO                                                          G1002900
      COS=ZERO                                                          G1003000
      SIN=ONE                                                           G1003100
      RETURN                                                            G1003200
      END                                                               G1003300
