comparison toolboxes/FullBNT-1.0.7/bnt/potentials/@scgcpot/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,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
11 if nargin < 2
12 tailnodes = 1:pot.ctailsize;
13 end
14
15 successful = [];
16
17 % Look for all columns beeing equal to zero
18 for i = tailnodes
19 if ~any(pot.B(:,i))
20 successful = [successful i];
21 end
22 end
23
24 remain = mysetdiff(1:pot.ctailsize,successful);
25
26 % Erase the zero-columns and decrease the tailsize
27 pot.B = pot.B(:,remain);
28 pot.ctailsize = pot.ctailsize - length(successful);
29
30 % Return the reduced potential
31 reduced_pot = pot;
32