about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/CPDs/@gaussian_CPD/private/CPD_to_linear_gaussian.m
blob: dfc0ccccfaf76816516393e96fbf27f01d0482ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function [mu, Sigma, W] = CPD_to_linear_gaussian(CPD, domain, ns, cnodes, evidence)

ps = domain(1:end-1);
dnodes = mysetdiff(1:length(ns), cnodes);
dps = myintersect(ps, dnodes); % discrete parents

if isempty(dps)
  Q = 1;
else
  assert(~any(isemptycell(evidence(dps))));
  dpvals = cat(1, evidence{dps});
  Q = subv2ind(ns(dps), dpvals(:)');
end

mu = CPD.mean(:,Q);
Sigma = CPD.cov(:,:,Q);
W = CPD.weights(:,:,Q);