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


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

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


desc
@Calculate the probabilities of being in state i at time t, gamma.
@


1.2
log
@Adjusted the dimensioning --- no more 1's.
@
text
@subroutine gfun(alpha,beta,epsilon,n,nstate,wrk,gamma)
implicit double precision(a-h,o-z)
dimension alpha(nstate,n), beta(nstate,n), gamma(nstate,n)
dimension wrk(nstate)

zero = 0.d0
ook  = 1.d0/dble(nstate)

do kt = 1,n {
	tsum = zero
	do i = 1,nstate {
		wrk(i) = alpha(i,kt)*beta(i,kt)
		tsum = tsum + wrk(i)
	}
	if(tsum<epsilon) {
		do i = 1,nstate {
			gamma(i,kt) = ook
		}
	}
	else {
		do i = 1,nstate {
			gamma(i,kt) = wrk(i)/tsum
		}
	}
}

return
end
@


1.1
log
@Initial revision
@
text
@d3 2
a4 2
dimension alpha(nstate,1), beta(nstate,1), gamma(nstate,1)
dimension wrk(1)
@
