view toolboxes/FullBNT-1.0.7/bnt/inference/static/@pearl_inf_engine/private/prod_lambda_msgs.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
line wrap: on
line source
function lam = prod_lambda_msgs(n, cs, msg, msg_type, except)

if nargin < 5, except = -1; end

lam = msg{n}.lambda_from_self;
switch msg_type
  case 'd',
   for i=1:length(cs)
     c = cs(i);
     if c ~= except
       lam = lam .* msg{n}.lambda_from_child{i};
     end
   end  
 case 'g',
  if isinf(lam.precision) % isfield(lam, 'observed_val')
    return; % pass on the observed msg
  end
   for i=1:length(cs)
     c = cs(i);
     if c ~= except
       m = msg{n}.lambda_from_child{i};
       lam.precision = lam.precision + m.precision;
       lam.info_state = lam.info_state + m.info_state;
     end
   end  
end