about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/CPDs/@tabular_CPD/Old/mult_CPD_and_pi_msgs.m
blob: b67ed2e629c237cb806908b28cb6e7edae4dbbb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function T = mult_CPD_and_pi_msgs(CPD, n, ps, msgs, except)
% MULT_CPD_AND_PI_MSGS Multiply the CPD and all the pi messages from parents, perhaps excepting one
% T = mult_CPD_and_pi_msgs(CPD, n, ps, msgs, except)

if nargin < 5, except = -1; end

dom = [ps n];
%ns = sparse(1, max(dom));
ns = zeros(1, max(dom));
ns(dom) = mysize(CPD.CPT);
T = dpot(dom, ns(dom), CPD.CPT);
for i=1:length(ps)
  p = ps(i);
  if p ~= except
    T = multiply_by_pot(T, dpot(p, ns(p), msgs{n}.pi_from_parent{i}.T)); 
  end
end