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 / @discrete_CPD / private / prod_CPT_and_pi_msgs.m @ 8:b5b38998ef3b
History | View | Annotate | Download (527 Bytes)
| 1 |
function T = prod_CPT_and_pi_msgs(CPD, n, ps, msgs, except) |
|---|---|
| 2 |
% PROD_CPT_AND_PI_MSGS Multiply the CPD and all the pi messages from parents, perhaps excepting one |
| 3 |
% T = prod_CPY_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 |
CPT = CPD_to_CPT(CPD); |
| 11 |
ns(dom) = mysize(CPT); |
| 12 |
T = dpot(dom, ns(dom), CPT); |
| 13 |
for i=1:length(ps) |
| 14 |
p = ps(i); |
| 15 |
if p ~= except |
| 16 |
T = multiply_by_pot(T, dpot(p, ns(p), msgs{n}.pi_from_parent{i}));
|
| 17 |
end |
| 18 |
end |