# Dimension of the lattice
height <- 8
width <- 10
# Interaction parameter
Beta <- 0.6 # Isotropic configuration
# Beta <- c(0.6, 0.6) # Anisotropic configuration when nei = 4
# Beta <- c(0.6, 0.6, 0.6, 0.6) # Anisotropic configuration when nei = 8
# Number of colors
K <- 2
# Number of neighbors
G <- 4
# Optional potential on sites
potential <- runif(K,-1,1)
# Optional borders.
Top <- Bottom <- sample(0:(K-1), width, replace = TRUE)
Left <- Right <- sample(0:(K-1), height, replace = TRUE)
Corner <- sample(0:(K-1), 4, replace = TRUE)
# Exact sampling for the default setting
exact.mrf(h = height, w = width, param = Beta, view = TRUE)
# When specifying the number of colors and neighbors
exact.mrf(h = height, w = width, ncolors = K, nei = G, param = Beta,
view = TRUE)
# When specifying an optional potential on sites
exact.mrf(h = height, w = width, ncolors = K, nei = G, param = Beta,
pot = potential, view = TRUE)
# When specifying possible borders. The users will omit to mention all
# the non-existing borders
exact.mrf(h = height, w = width, ncolors = K, nei = G, param = Beta,
top = Top, left = Left, bottom = Bottom, right = Right, corner = Corner, view = TRUE)
Run the code above in your browser using DataLab