SUBROUTINE FKWMES
*-- Author : S.Burke / J.V. Morris
      SUBROUTINE FKWMES(MES,HMES,GMES,W,HGW)
**********************************************************************                                        
*                                                                    *                                        
* Compute a measurement vector weighted by the inverse of its        *                                        
* covariance, and transformed into state vector space                *                                        
*                                                                    *                                        
* Output is HGW = HMES.GMES.W (MES is the number of measurements)    *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                               
      DIMENSION HMES(2,2),GMES(2,2),W(2),HGW(2)                         
                                                                        
**********************************************************************                                        
                                                                        
      IF (MES.EQ.1) THEN                                                
         HGW(1) = HMES(1,1)*GMES(1,1)*W(1)                              
         HGW(2) = HMES(1,2)*GMES(1,1)*W(1)                              
      ELSE                                                              
         HGW(1) = HMES(1,1)*GMES(1,1)*W(1) + HMES(1,1)*GMES(2,1)*W(2)   
     &          + HMES(2,1)*GMES(2,1)*W(1) + HMES(2,1)*GMES(2,2)*W(2)   
         HGW(2) = HMES(1,2)*GMES(1,1)*W(1) + HMES(1,2)*GMES(2,1)*W(2)   
     &          + HMES(2,2)*GMES(2,1)*W(1) + HMES(2,2)*GMES(2,2)*W(2)   
      ENDIF                                                             
                                                                        
      RETURN                                                            
      END                                                               
*