end</span>
</pre><h2>Infer single marginals using jtree<a name="5"></a></h2><pre class="codeinput"><span class="keyword">if</span> 1
    tic;
    dgm        = hmmToDgm(model, T, <span class="string">'infEngine'</span>, <span class="string">'jtree'</span>);
    [margJtree, logpDgm]  = dgmInferNodes(dgm, <span class="string">'localev'</span>, X);
    gammaJtree = tfMarg2Mat(margJtree);
    t = toc;
    fprintf(<span class="string">'jtree : %g seconds\n'</span>, t);
    assert(approxeq(gamma, gammaJtree));
<sp