wolffd@0: function m = marginal_family(engine, i, t) wolffd@0: % MARGINAL_FAMILY Compute the marginal on the specified family (bk) wolffd@0: % marginal = marginal_family(engine, i, t) wolffd@0: wolffd@0: % This is just like inf_engine/marginal_family, except when we call wolffd@0: % marginal_nodes, we provide a 4th argument, to tell it's a family. wolffd@0: wolffd@0: if nargin < 3, t = 1; end wolffd@0: wolffd@0: bnet = bnet_from_engine(engine); wolffd@0: if t==1 wolffd@0: m = marginal_nodes(engine, family(bnet.dag, i), t, 1); wolffd@0: else wolffd@0: ss = length(bnet.intra); wolffd@0: fam = family(bnet.dag, i+ss); wolffd@0: if any(fam<=ss) wolffd@0: % i has a parent in the preceeding slice wolffd@0: % Hence the lowest numbered slice containing the family is t-1 wolffd@0: m = marginal_nodes(engine, fam, t-1, 1); wolffd@0: else wolffd@0: % The family all fits inside slice t wolffd@0: % Hence shift the indexes back to slice 1 wolffd@0: m = marginal_nodes(engine, fam-ss, t, 1); wolffd@0: end wolffd@0: end