about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/inference/static/@pearl_inf_engine/private/prod_lambda_msgs.m
blob: 5a96d25956233766133b548cc9735c95e65c9412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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