c;
    fprintf('velim : %g seconds\n', t);
    assert(approxeq(gamma, gammaVelim));
end
%% Infer single marginals using jtree
if 1
    tic;
    dgm        = hmmToDgm(model, T, 'infEngine', 'jtree');
    [margJtree, logpDgm]  = dgmInferNodes(dgm, 'localev', X);
    gammaJtree = tfMarg2Mat(margJtree);
    t = toc;
    fprintf('jtree : %g seconds\n', t);
    assert(approxeq(gamma, gammaJtree));
end
%%
%% infer single marginals using libdai's Jtree code
if libdaiInstalled
    tic;
    dgm        = hmmToDgm(mode