      SUBROUTINE INV2X2 (A,AINV,DET)
      DOUBLE PRECISION A(2,2), AINV(2,2), DET
      DET = A(1,1)*A(2,2) - A(1,2)*A(2,1)
      AINV(1,1) =  A(2,2)/DET
      AINV(1,2) = -A(1,2)/DET
      AINV(2,1) = -A(2,1)/DET
      AINV(2,2) =  A(1,1)/DET
      RETURN
      END
