SUBROUTINE FKRPXY
*-- Author : S.Burke / J.V. Morris
      SUBROUTINE FKRPXY(SIN,CIN,SOUT,COUT)
**********************************************************************                                        
*                                                                    *                                        
* Transform a state vector and covariance from (R,PHI) to (x,y)      *                                        
*                                                                    *                                        
* Both are assumed to be at fixed z.                                 *                                        
*                                                                    *                                        
*                        *** NOT TESTED ***                          *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)                               
                                                                        
      DIMENSION SIN(5),CIN(5,5),SOUT(5),COUT(5,5)                       
                                                                        
**********************************************************************                                        
                                                                        
      CALL UCOPY(SIN(3),SOUT(3),6)                                                                     
      CALL UCOPY(CIN(3,3),COUT(3,3),26)                                                                
                                                                        
      CPHI = COS(SIN(2))                                                
      C2PHI = CPHI*CPHI                                                 
      S2PHI = 1.D0 - C2PHI                                              
      SPHI = SQRT(S2PHI)                                                
      CSPHI = CPHI*SPHI                                                 
      R = SIN(1)                                                        
      R2 = R*R                                                          
                                                                        
      X = R*CPHI                                                        
      Y = R*SPHI                                                        
      SOUT(1) = X                                                       
      SOUT(2) = Y                                                       
                                                                        
      CRR = CIN(1,1)                                                    
      CRP = CIN(2,1)                                                    
      CPP = CIN(2,2)                                                    
                                                                        
      COUT(1,1) = C2PHI*CRR - 2.D0*Y*CPHI*CRP + Y*Y*CPP                 
      COUT(2,1) = CSPHI*CRR + (C2PHI - S2PHI)*R*CRP - X*Y*CPP           
      COUT(3,1) = CPHI*CIN(3,1) - Y*CIN(3,2)                            
      COUT(4,1) = CPHI*CIN(4,1) - Y*CIN(4,2)                            
      COUT(5,1) = CPHI*CIN(5,1) - Y*CIN(5,2)                            
                                                                        
      COUT(2,2) = S2PHI*CRR + 2.D0*X*SPHI*CRP + X*X*CPP                 
      COUT(3,2) = SPHI*CIN(3,1) + X*CIN(3,2)                            
      COUT(4,2) = SPHI*CIN(4,1) + X*CIN(4,2)                            
      COUT(5,2) = SPHI*CIN(5,1) + X*CIN(5,2)                            
                                                                        
      RETURN                                                            
      END                                                               
*