wolffd@0: function marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam) wolffd@0: % function marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam) (jtree_2TBN) wolffd@0: wolffd@0: if nargin < 6, is_fam = 0; end wolffd@0: ss = engine.slice_size; wolffd@0: wolffd@0: if ~is_fam & (t > 1) & all(nodes<=ss) wolffd@0: nodes = nodes + ss; wolffd@0: end wolffd@0: wolffd@0: if t==1 wolffd@0: c = clq_containing_nodes(engine.jtree_engine1, nodes, is_fam); wolffd@0: else wolffd@0: c = clq_containing_nodes(engine.jtree_engine, nodes, is_fam); wolffd@0: end wolffd@0: if c == -1 wolffd@0: error(['no clique contains ' nodes]) wolffd@0: end wolffd@0: bigpot = b.clpot{c}; wolffd@0: pot = marginalize_pot(bigpot, nodes, engine.maximize); wolffd@0: marginal = pot_to_marginal(pot); wolffd@0: wolffd@0: % we convert the domain to the unrolled numbering system wolffd@0: % so that add_ev_to_dmarginal (maybe called in update_ess) extracts the right evidence. wolffd@0: if t > 1 wolffd@0: marginal.domain = nodes+(t-2)*engine.slice_size; wolffd@0: end wolffd@0: assert(~add_ev); wolffd@0: wolffd@0: wolffd@0: wolffd@0: