comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function lam = prod_lambda_msgs(n, cs, msg, msg_type, except)
2
3 if nargin < 5, except = -1; end
4
5 lam = msg{n}.lambda_from_self;
6 switch msg_type
7 case 'd',
8 for i=1:length(cs)
9 c = cs(i);
10 if c ~= except
11 lam = lam .* msg{n}.lambda_from_child{i};
12 end
13 end
14 case 'g',
15 if isinf(lam.precision) % isfield(lam, 'observed_val')
16 return; % pass on the observed msg
17 end
18 for i=1:length(cs)
19 c = cs(i);
20 if c ~= except
21 m = msg{n}.lambda_from_child{i};
22 lam.precision = lam.precision + m.precision;
23 lam.info_state = lam.info_state + m.info_state;
24 end
25 end
26 end
27
28
29