about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/inference/online/@hmm_2TBN_inf_engine/marginal_nodes.m
blob: 6fa6c2b31cb7116127cec89169760b485f820186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function marginal = marginal_nodes(engine, b, nodes, t, add_ev)
% MARGINAL_NODES Compute the marginal on the specified nodes (hmm_2TBN)
% marginal = marginal_nodes(engine, b, nodes, t, add_ev)
%
% nodes must be a singleton set 

assert(length(nodes)==1)
ss = engine.slice_size;

i = nodes(1);
bigT = b.gamma;
dom = i + (t-1)*ss;

%id = engine.marg_singleton_ndx_id(i);
%global SD_NDX
%ndx = SD_NDX{id};
%marginal.T = marg_table_ndxSD(bigT, engine.maximize, ndx);

ns = engine.eff_node_sizes(:);
bigdom = 1:ss;
marginal.T = marg_table(bigT, bigdom + (t-1)*ss, ns(bigdom), dom, engine.maximize);

marginal.domain = dom;
assert(~add_ev);
%if add_ev
%  marginal = add_ev_to_dmarginal(marginal, engine.evidence, engine.node_sizes);
%end