comparison toolboxes/FullBNT-1.0.7/bnt/inference/static/@stab_cond_gauss_inf_engine/push.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [engine, clqtoroot] = push(engine, clq, pushdom)
2 %PUSH_POT push the variables in putshdom which is subset of clq to the clique toword the root and get new engine
3 %pushdom is pushed variables set
4 %clq is the index of the clique that pushdom belongs to
5
6 clqdom = engine.cliques{clq};
7 assert( mysubset(pushdom, clqdom));
8 clqtoroot = parents(engine.jtree, clq);
9 %sepdom = engine.separator{clq, clqtoroot};
10 sepdom = engine.separator{clqtoroot, clq};
11
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Calculate the strong marginal of the union of pushdom and and the separatordomain and %
14 % the corresponding complement %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 %[margpot, comppot] = complement_pot(engine.clpot{clq}, pushdom);
17 newsepdom = myunion(pushdom,sepdom);
18 [margpot,comppot] = complement_pot(engine.clpot{clq}, newsepdom);
19 engine.clpot{clqtoroot} = direct_combine_pots(engine.clpot{clqtoroot}, margpot);
20 engine.clpot{clq} = comppot;
21
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 % Calculation of the new separator and separatorpotential of the junction tree %
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 engine.seppot{clqtoroot, clq} = direct_combine_pots(engine.seppot{clqtoroot, clq}, margpot);
26 engine.separator{clqtoroot, clq} = myunion(engine.separator{clqtoroot, clq}, pushdom);
27
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29 % Add pushdomain to the clique towards the root %
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 engine.cliques{clqtoroot} = myunion(engine.cliques{clqtoroot}, pushdom);
32
33 num_cliques = length(engine.cliques);
34 B = sparse(num_cliques, 1);
35 for i=1:num_cliques
36 B(i, engine.cliques{i}) = 1;
37 end
38 engine.cliques_bitv = B;