about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/inference/static/@belprop_fg_inf_engine/loopy_converged.m
blob: b9015e85ab0b7c882c6123419c28f8460de4a7d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
function niter = loopy_converged(engine)
% LOOPY_CONVERGED Did loopy belief propagation converge? 0 means no, eles we return the num. iterations.
% function niter = loopy_converged(engine)
%
% We use a simple heuristic: we say convergence occurred if the number of iterations
% used was less than the maximum allowed.

if engine.niter == engine.max_iter
  niter = 0;
else
  niter = engine.niter;
end