head	1.2;
access;
symbols;
locks
	rolf:1.2; strict;
comment	@# @;


1.2
date	2013.04.17.02.32.32;	author rolf;	state Exp;
branches;
next	1.1;

1.1
date	2009.09.23.03.43.41;	author rturner;	state Exp;
branches;
next	;


desc
@Calculate the probability xi of a transition from state i to
state j at time t.
@


1.2
log
@Adjusted the dimensioning --- no more 1's.  Fixed up the
final dimension of xi to be n-1 (and passed the necessary
value).
@
text
@subroutine xfun(alpha,beta,fy,tpm,epsilon,n,nstate,nm1,wrk,xi)
implicit double precision(a-h,o-z)
dimension alpha(nstate,n), beta(nstate,n), fy(nstate,n)
dimension tpm(nstate,nstate), wrk(nstate,nstate), xi(nstate,nstate,nm1)

one  = 1.d0
zero = 0.d0
dns2 = dble(nstate*nstate)

do ktp = 2,n {
	kt = ktp - 1
	tsum = zero
	do i = 1,nstate {
		do j = 1, nstate {
			wrk(i,j) = alpha(i,kt)*fy(j,ktp)*beta(j,ktp)*tpm(i,j)
			tsum = tsum + wrk(i,j)
		}
	}
	if(tsum<epsilon) {
		do i = 1,nstate {
			do j = 1,nstate {
				xi(i,j,kt) = one/dns2
			}
		}
	}
	else {
		do i = 1,nstate {
			do j = 1,nstate {
				xi(i,j,kt) = wrk(i,j)/tsum
			}
		}
	}
}

return
end
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
subroutine xfun(alpha,beta,fy,tpm,epsilon,n,nstate,wrk,xi)
d3 2
a4 2
dimension alpha(nstate,1), beta(nstate,1), fy(nstate,1)
dimension tpm(nstate,1), wrk(nstate,1), xi(nstate,nstate,1)
@
