To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / CPDs / @tabular_CPD / Old / mult_CPD_and_pi_msgs.m @ 8:b5b38998ef3b
History | View | Annotate | Download (515 Bytes)
| 1 |
function T = mult_CPD_and_pi_msgs(CPD, n, ps, msgs, except) |
|---|---|
| 2 |
% MULT_CPD_AND_PI_MSGS Multiply the CPD and all the pi messages from parents, perhaps excepting one |
| 3 |
% T = mult_CPD_and_pi_msgs(CPD, n, ps, msgs, except) |
| 4 |
|
| 5 |
if nargin < 5, except = -1; end |
| 6 |
|
| 7 |
dom = [ps n]; |
| 8 |
%ns = sparse(1, max(dom)); |
| 9 |
ns = zeros(1, max(dom)); |
| 10 |
ns(dom) = mysize(CPD.CPT); |
| 11 |
T = dpot(dom, ns(dom), CPD.CPT); |
| 12 |
for i=1:length(ps) |
| 13 |
p = ps(i); |
| 14 |
if p ~= except |
| 15 |
T = multiply_by_pot(T, dpot(p, ns(p), msgs{n}.pi_from_parent{i}.T));
|
| 16 |
end |
| 17 |
end |