Mercurial > hg > camir-aes2014
annotate 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 |
rev | line source |
---|---|
wolffd@0 | 1 function [reduced_pot,successful] = reduce(pot,tailnodes) |
wolffd@0 | 2 % Executes the reduce operation defined in |
wolffd@0 | 3 % Stable Local Computation with Conditional Gaussian Distributions |
wolffd@0 | 4 % Steffen L. Lauritzen |
wolffd@0 | 5 % Frank Jensen |
wolffd@0 | 6 % September 1999 |
wolffd@0 | 7 % The potential pot is reduced if B contains any zero columns |
wolffd@0 | 8 % The test are restricted to the positions in tailnodes. |
wolffd@0 | 9 % Any columns successfully deleted are entered in the array successful |
wolffd@0 | 10 |
wolffd@0 | 11 if nargin < 2 |
wolffd@0 | 12 tailnodes = 1:pot.ctailsize; |
wolffd@0 | 13 end |
wolffd@0 | 14 |
wolffd@0 | 15 successful = []; |
wolffd@0 | 16 |
wolffd@0 | 17 % Look for all columns beeing equal to zero |
wolffd@0 | 18 for i = tailnodes |
wolffd@0 | 19 if ~any(pot.B(:,i)) |
wolffd@0 | 20 successful = [successful i]; |
wolffd@0 | 21 end |
wolffd@0 | 22 end |
wolffd@0 | 23 |
wolffd@0 | 24 remain = mysetdiff(1:pot.ctailsize,successful); |
wolffd@0 | 25 |
wolffd@0 | 26 % Erase the zero-columns and decrease the tailsize |
wolffd@0 | 27 pot.B = pot.B(:,remain); |
wolffd@0 | 28 pot.ctailsize = pot.ctailsize - length(successful); |
wolffd@0 | 29 |
wolffd@0 | 30 % Return the reduced potential |
wolffd@0 | 31 reduced_pot = pot; |
wolffd@0 | 32 |