diff --git a/src/MatrixProductBP.jl b/src/MatrixProductBP.jl index 1f93f5c1..ea91ba53 100644 --- a/src/MatrixProductBP.jl +++ b/src/MatrixProductBP.jl @@ -49,7 +49,7 @@ export pair_observations_nondirected, pair_obs_undirected_to_directed, exact_prob, exact_marginals, site_marginals, exact_autocorrelations, exact_autocovariances, exact_marginal_expectations, - uniform_exact_msg, mpbp_exact, + uniform_exact_msg, mpbp_exact, exact_mpbp_infinite_graph, SoftMarginSampler, onesample!, onesample, sample!, sample, marginals, pair_marginals, continuous_sis_sampler, simulate_queue_sis!, draw_node_observations!, AtomicVector, diff --git a/src/exact.jl b/src/exact.jl index 506c8e25..71196228 100644 --- a/src/exact.jl +++ b/src/exact.jl @@ -281,4 +281,19 @@ function marginals(m::ExactMsg) end end -is_periodic(bp::MPBP{G,F,V,<:ExactMsg{P},<:ExactMsg{P}}) where {G,F,V,P} = P \ No newline at end of file +is_periodic(bp::MPBP{G,F,V,<:ExactMsg{P},<:ExactMsg{P}}) where {G,F,V,P} = P + +function exact_mpbp_infinite_graph(k::Integer, wᵢ::Vector{U}, qi::Int, + ϕᵢ = fill(ones(qi), length(wᵢ)); + ψₖᵢ = fill(ones(qi, qi), length(wᵢ)), + periodic = false) where {U<:BPFactor} + + T = length(wᵢ) - 1 + @assert length(ϕᵢ) == T + 1 + @assert length(ψₖᵢ) == T + 1 + + g = InfiniteRegularGraph(k) + μ = uniform_exact_msg((qi, qi), T; periodic) + b = uniform_exact_msg((qi,), T; periodic) + MPBP(g, [wᵢ], [ϕᵢ], [ψₖᵢ], [μ], [b], [0.0]) +end \ No newline at end of file