/pre><h2>infer single marginals using varelim<a name="4"></a></h2><pre class="codeinput"><span class="keyword">if</span> 0
    tic;
    dgm        = hmmToDgm(model, T, <span class="string">'infEngine'</span>, <span class="string">'varelim'</span>);
    margVelim  = dgmInferNodes(dgm, <span class="string">'localev'</span>, X);
    gammaVelim = tfMarg2Mat(margVelim);
    t = toc;
    fprintf(<span class="string">'velim : %g seconds\n'</span>, t);
    assert(approxeq(gamma, gammaVelim));
<span class="keyword">