wolffd@0: function [reduced_pot,successful] = reduce(pot,tailnodes) wolffd@0: % Executes the reduce operation defined in wolffd@0: % Stable Local Computation with Conditional Gaussian Distributions wolffd@0: % Steffen L. Lauritzen wolffd@0: % Frank Jensen wolffd@0: % September 1999 wolffd@0: % The potential pot is reduced if B contains any zero columns wolffd@0: % The test are restricted to the positions in tailnodes. wolffd@0: % Any columns successfully deleted are entered in the array successful wolffd@0: wolffd@0: if nargin < 2 wolffd@0: tailnodes = 1:pot.ctailsize; wolffd@0: end wolffd@0: wolffd@0: successful = []; wolffd@0: wolffd@0: % Look for all columns beeing equal to zero wolffd@0: for i = tailnodes wolffd@0: if ~any(pot.B(:,i)) wolffd@0: successful = [successful i]; wolffd@0: end wolffd@0: end wolffd@0: wolffd@0: remain = mysetdiff(1:pot.ctailsize,successful); wolffd@0: wolffd@0: % Erase the zero-columns and decrease the tailsize wolffd@0: pot.B = pot.B(:,remain); wolffd@0: pot.ctailsize = pot.ctailsize - length(successful); wolffd@0: wolffd@0: % Return the reduced potential wolffd@0: reduced_pot = pot; wolffd@0: