*-- Author : S.Burke / J.V. Morris SUBROUTINE FKMXM(X,G,Q) ********************************************************************** * * * Optimised matrix transformation. * * Used to calculate the smoothed covariance matrix; the gain matrix * * (G) is known to have G(3,x)=delta(3,x). * * * ********************************************************************** IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION X(5,5),G(5,5),Q(5,5) ********************************************************************** DO 200 J1=1,5 * First work out (G*X)j1 k2 for each k2 (contracting over k1). IF (J1.NE.3) THEN GX1 = G(J1,1)*X(1,1) & + G(J1,2)*X(2,1) & + G(J1,3)*X(3,1) & + G(J1,4)*X(4,1) & + G(J1,5)*X(5,1) GX2 = G(J1,1)*X(2,1) & + G(J1,2)*X(2,2) & + G(J1,3)*X(3,2) & + G(J1,4)*X(4,2) & + G(J1,5)*X(5,2) GX3 = G(J1,1)*X(3,1) & + G(J1,2)*X(3,2) & + G(J1,3)*X(3,3) & + G(J1,4)*X(4,3) & + G(J1,5)*X(5,3) GX4 = G(J1,1)*X(4,1) & + G(J1,2)*X(4,2) & + G(J1,3)*X(4,3) & + G(J1,4)*X(4,4) & + G(J1,5)*X(5,4) GX5 = G(J1,1)*X(5,1) & + G(J1,2)*X(5,2) & + G(J1,3)*X(5,3) & + G(J1,4)*X(5,4) & + G(J1,5)*X(5,5) ELSE GX1 = X(3,1) GX2 = X(3,2) GX3 = X(3,3) GX4 = X(4,3) GX5 = X(5,3) ENDIF * Then do: (Q)j1 j2 = Sum(k2) (G*Q)j1 k2 * (G)j2 k2 DO 100 J2=J1,5 IF (J2.NE.3) THEN Q(J2,J1) = GX1*G(J2,1) & + GX2*G(J2,2) & + GX3*G(J2,3) & + GX4*G(J2,4) & + GX5*G(J2,5) ELSE Q(3,J1) = GX3 ENDIF 100 CONTINUE 200 CONTINUE RETURN END *