annotate toolboxes/FullBNT-1.0.7/bnt/potentials/@scgpot/reduce_pot.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [reduced_pot,successful] = reduce_pot(pot,tailnodes)
Daniel@0 2 % Executes the reduce operation defined in
Daniel@0 3 % Stable Local Computation with Conditional Gaussian Distributions
Daniel@0 4 % Steffen L. Lauritzen
Daniel@0 5 % Frank Jensen
Daniel@0 6 % September 1999
Daniel@0 7 % The potential pot is reduced if B contains any zero columns
Daniel@0 8 % The test are restricted to the positions in tailnodes.
Daniel@0 9 % Any columns successfully deleted are entered in the array successful
Daniel@0 10 if nargin < 2
Daniel@0 11 tailnodes = pot.ctaildom;
Daniel@0 12 end
Daniel@0 13
Daniel@0 14 successful = [];
Daniel@0 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 16 % Keep track of remaining tailnodes %
Daniel@0 17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 18 rem_tailnodes = pot.ctaildom;
Daniel@0 19 for i = tailnodes
Daniel@0 20 pos = find(i==rem_tailnodes);
Daniel@0 21 successful_red = [pos];
Daniel@0 22 red_scgcpot = cell(1,pot.dsize);
Daniel@0 23 j = 1;
Daniel@0 24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 25 % Test whether all components of pot.scgpotc can be reduced %
Daniel@0 26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 27 while ((j <= pot.dsize) & ~isempty(successful_red))
Daniel@0 28 [cpot,successful_red] = reduce_pot(pot.scgpotc{j},pos);
Daniel@0 29 red_scgcpot{j} = cpot;
Daniel@0 30 j = j + 1;
Daniel@0 31 end
Daniel@0 32
Daniel@0 33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 34 % If i is a reducible tailnode, then reduce the potential %
Daniel@0 35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Daniel@0 36 if ~isempty(successful_red)
Daniel@0 37 successful = [successful i];
Daniel@0 38 pot.scgpotc = red_scgcpot;
Daniel@0 39 rem_tailnodes = mysetdiff(rem_tailnodes,i);
Daniel@0 40 end;
Daniel@0 41 end
Daniel@0 42
Daniel@0 43 pot.ctaildom = rem_tailnodes;
Daniel@0 44 positions = find_equiv_posns(rem_tailnodes,pot.ctaildom);
Daniel@0 45 pot.ctailsizes = pot.ctailsizes(positions);
Daniel@0 46 pot.ctailsize = sum(pot.ctailsizes);
Daniel@0 47 pot.domain = mysetdiff(pot.domain,successful);
Daniel@0 48 reduced_pot = pot;
Daniel@0 49
Daniel@0 50
Daniel@0 51
Daniel@0 52
Daniel@0 53