comparison toolboxes/FullBNT-1.0.7/bnt/potentials/@scgpot/reduce_pot.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 [reduced_pot,successful] = reduce_pot(pot,tailnodes)
2 % Executes the reduce operation defined in
3 % Stable Local Computation with Conditional Gaussian Distributions
4 % Steffen L. Lauritzen
5 % Frank Jensen
6 % September 1999
7 % The potential pot is reduced if B contains any zero columns
8 % The test are restricted to the positions in tailnodes.
9 % Any columns successfully deleted are entered in the array successful
10 if nargin < 2
11 tailnodes = pot.ctaildom;
12 end
13
14 successful = [];
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16 % Keep track of remaining tailnodes %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 rem_tailnodes = pot.ctaildom;
19 for i = tailnodes
20 pos = find(i==rem_tailnodes);
21 successful_red = [pos];
22 red_scgcpot = cell(1,pot.dsize);
23 j = 1;
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 % Test whether all components of pot.scgpotc can be reduced %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 while ((j <= pot.dsize) & ~isempty(successful_red))
28 [cpot,successful_red] = reduce_pot(pot.scgpotc{j},pos);
29 red_scgcpot{j} = cpot;
30 j = j + 1;
31 end
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 % If i is a reducible tailnode, then reduce the potential %
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 if ~isempty(successful_red)
37 successful = [successful i];
38 pot.scgpotc = red_scgcpot;
39 rem_tailnodes = mysetdiff(rem_tailnodes,i);
40 end;
41 end
42
43 pot.ctaildom = rem_tailnodes;
44 positions = find_equiv_posns(rem_tailnodes,pot.ctaildom);
45 pot.ctailsizes = pot.ctailsizes(positions);
46 pot.ctailsize = sum(pot.ctailsizes);
47 pot.domain = mysetdiff(pot.domain,successful);
48 reduced_pot = pot;
49
50
51
52
53