module formulacion_matR_Kalman
	IMPLICIT NONE
CONTAINS
    
    SUBROUTINE evalfj_matR_kalman (Tang,DIM)
    integer::DIM
	REAL(8),DIMENSION(DIM,DIM)::Tang,matRMmatR,matRMmatRp,matRKmatR,matRCmatR,dwk2_dz,dwk2_dzp,dzp_dz,dzs_dz
	REAL(8) dt2
	
    INTENT(OUT) Tang
    
    Tang=dt2*matmul(matRMmatR,dzs_dz)+dt2*(matRKmatR+matmul(matRCmatR+matRMmatRp,dzp_dz)+matmul(matRMmatR,(dwk2_dz+matmul(dwk2_dzp,dzp_dz))))

    END SUBROUTINE evalfj_matR_kalman
end module formulacion_matR_Kalman

