wolffd@0: function niter = loopy_converged(engine) wolffd@0: % LOOPY_CONVERGED Did loopy belief propagation converge? 0 means no, eles we return the num. iterations. wolffd@0: % function niter = loopy_converged(engine) wolffd@0: % wolffd@0: % We use a simple heuristic: we say convergence occurred if the number of iterations wolffd@0: % used was less than the maximum allowed. wolffd@0: wolffd@0: if engine.niter == engine.max_iter wolffd@0: niter = 0; wolffd@0: else wolffd@0: niter = engine.niter; wolffd@0: end wolffd@0: %conv = (strcmp(engine.protocol, 'tree') | (engine.niter < engine.max_iter));