Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@gaussian_CPD/CPD_to_pi.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 pi = CPD_to_pi(CPD, msg_type, n, ps, msg, evidence) | |
2 % CPD_TO_PI Compute the pi vector (gaussian) | |
3 % function pi = CPD_to_pi(CPD, msg_type, n, ps, msg, evidence) | |
4 | |
5 switch msg_type | |
6 case 'd', | |
7 error('gaussian_CPD can''t create discrete msgs') | |
8 case 'g', | |
9 [m, Q, W] = gaussian_CPD_params_given_dps(CPD, [ps n], evidence); | |
10 cps = ps(CPD.cps); | |
11 cpsizes = CPD.sizes(CPD.cps); | |
12 pi.mu = m; | |
13 pi.Sigma = Q; | |
14 for k=1:length(cps) % only get pi msgs from cts parents | |
15 %bk = block(k, cpsizes); | |
16 bk = CPD.cps_block_ndx{k}; | |
17 Bk = W(:, bk); | |
18 m = msg{n}.pi_from_parent{k}; | |
19 pi.Sigma = pi.Sigma + Bk * m.Sigma * Bk'; | |
20 pi.mu = pi.mu + Bk * m.mu; % m.mu = u(k) | |
21 end | |
22 end |