wolffd@0: function pot = combine_pots(pot1, pot2) wolffd@0: % COMBINE_POTS combine two potentials wolffd@0: % pot = combine_pots(pot1, pot2) wolffd@0: wolffd@0: % Reduce both potentials before trying to combine them. wolffd@0: % Cf. "Stable Local computation with Conditional Gaussian Distributions", page 9 wolffd@0: % Consider again two potentials with minimal tail wolffd@0: wolffd@0: % Guarantee minimal tails. If pot1 or pot2 are minimal, they are not changed wolffd@0: pot1 = reduce_pot(pot1); wolffd@0: pot2 = reduce_pot(pot2); wolffd@0: wolffd@0: %if the intersect set of these two potentials' head conts. combination is undifined wolffd@0: if ~isempty( myintersect(pot1.cheaddom, pot2.cheaddom) ) wolffd@0: return; wolffd@0: end wolffd@0: wolffd@0: if isempty( myintersect(pot1.domain, pot2.cheaddom) ) | isempty( myintersect(pot2.domain, pot1.cheaddom)) wolffd@0: % if satisfy the condition of directed combine wolffd@0: pot = direct_combine_pots(pot1, pot2); wolffd@0: else wolffd@0: % perform recursive combine wolffd@0: pot = recursive_combine_pots(pot1, pot2); wolffd@0: end