#
# UpdateFunction.R
#
# Update function of a Markov chain having transition matrix P.
# See p.19 in Häggström (2002).
#
# Lasse Leskelä 2011-11-05
#
# Input:
# i (integer in [1,k]) current state of the Markov chain
# x (real number in (0,1)) argument of the update function
# P (kxk-matrix) transition matrix of the Markov chain: P[i,j] = Pr(X_1=j | X_0=i)
#
# Output:
# j (integer in [1,k]) the update function of matrix P evaluated at i and x
#

source('InitiationFunction.R')

UpdateFunction <- function (i,x,P) {
  j <- InitiationFunction(x,P[i,])
  j
}
