*-- Author : S.Burke / J.V. Morris
SUBROUTINE FKLRFL(JPL,IFLAG,IERR)
**********************************************************************
* *
* Reverse Kalman Filter used to add or remove a measurement *
* at plane JPL *
* *
* ERROR CONDITIONS; *
* IERR = 0 ; normal termination *
* -> IERR = 101 ; no smoothed vector at JPL *
* -> IERR = 103 ; no measurement at JPL *
* -> IERR = 104 ; invalid value of IFLAG *
* -> IERR = 107 ; failure to invert measurement covariance *
* -> IERR = 111 ; failure to invert filtered covariance *
* -> IERR = 116 ; theta > pi/2 (reset to pi/4) *
* IERR = 17 ; theta > 1 (warning) *
* *
* -> Fatal errors *
* *
* NB All fatal errors result in the update not being made, and are *
* therefore recoverable *
* *
**********************************************************************
*KEEP,FKECODE.
*KEND.
*
* Common block definitions
*
*KEEP,FKNPL.
*
* Per-track values can go in H1WORK; note that LTRUE and LFIRST must
* be set at least per event.
*
* This is about 36k words long; the remaining common blocks are
* about 3.6k in total. Some of this could be in /H1WORK/, but the
* blocks would have to be reorganised.
*
* /FKPROJ/
* /FKFILT/
* /FKSMTH/
* /FKINT/
* /FKRSID/
* /FKTRUE/
* /FKDBG/
*KEEP,FKMEAS.
*KEEP,FKFLAG.
*KEEP,FKSMTH.
*KEND.
**********************************************************************
*
* Local arrays ...
*
**********************************************************************
*
* Initialisation and checks ...
*
* Has smoothing to JPL been done ...... if not, terminate!
CALL FKERR(IUTIL,IROUT,IFATAL,IINF1,IERR)
* If no measurement has been made at JPL, then terminate
CALL FKERR(IUTIL,IROUT,IFATAL,IINF3,IERR)
* IFLAG should not be zero
CALL FKERR(IUTIL,IROUT,IFATAL,IINV,IERR)
**********************************************************************
* Invert CMES ...
CALL FKINV(MES(JPL),CMES(1,1,JPL),GMES,IFAIL)
CALL FKERR(IUTIL,IROUT,IFATAL,IMCV,IERR)
*
* If IFLAG is negative the point is being filtered out, so
* negate the (inverse of the) measurement covariance
*
*
* Compute the covariance
*
CALL FKCOVP(CSMT(1,1,JPL),HMES(1,1,JPL),GMES,
CALL FKCOVR(CSMT(1,1,JPL),HMES(1,1,JPL),GMES,
CALL FKERR(IUTIL,IROUT,IFATAL,IOCV,IERR)
* Compute the filtered state vector
CALL FKWMES(MES(JPL),HMES(1,1,JPL),GMES,WMES(1,JPL),HGW)
CALL FKWVEC(SSMT(1,JPL),WT,CSMTR(1,1,JPL),HGW,SSMTR(1,JPL))
CALL FKNORM(SSMTR(1,JPL),IFAIL)
IF (IFAIL.NE.0) CALL FKERR(IUTIL,IROUT,IFAIL/100,IFAIL,IERR)
* Copy the filtered vector and its covariance back into /FKSMTH/
CALL UCOPY(SSMTR(1,JPL),SSMT(1,JPL),10)
CALL FKCOPY(CSMTR(1,1,JPL),CSMT(1,1,JPL))
*