*-- Author : R. Henderson SUBROUTINE FPRCHI(PSEG,PERSEG,RSEG,RERSEG,Z,PROBCH) **: FPRCHI.......SM. Bug fix. Protect against small Chisq for PROB. **---------------------------------------------------------------------- C C--- Routine calculates the probability of PSEG and RSEG C--- being the same vector at Z given that PERSEG is the covariance C--- matrix of PSEG both calculated at at Z=0 C--- (these are the quantities supplied by FPFYUV) C--- and RERSEG is the covariance matrix of RSEG at Z C C--- The probability fron chisquare is returned as PROB C C--- C C--- Construct the derivative matrix C CALL VZERO(DERIV,16) C C--- Calculate X and Y at Z C C C--- Propagate PERSEG FROM Z=0 TO Z C CALL VZERO(WM,16) C--- CALL VZERO(COVAR,32) C--- C DO 111 I = 1,4 C WRITE(6,1001)(COVAR(I,J),J=1,4) C 1001 FORMAT(1X,'COVAR',4e15.6) C 111 CONTINUE C WRITE(6,*)'------------------------------' C C--- Add on the radial covariance matrix AT Z = Z C C C--- Calculate weight matrix C CALL DINV(4,COVAR,4,WORK,IFAIL) C--- C DO 131 I = 1,4 C WRITE(6,1003)(COVAR(I,J),J=1,4) C 1003 FORMAT(1X,'COVAR',4e15.6) C 131 CONTINUE C WRITE(6,*)'------------------------------' C C--- Now calculate chisquare C C C--- Find probability C C WRITE(6,*)PROBCH C WRITE(6,*)'------------------------------' *