diff options
Diffstat (limited to 'sourcecodes/bnt-master/KPMstats/clg_prob.m')
| -rw-r--r-- | sourcecodes/bnt-master/KPMstats/clg_prob.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMstats/clg_prob.m b/sourcecodes/bnt-master/KPMstats/clg_prob.m new file mode 100644 index 00000000..3ad7b761 --- /dev/null +++ b/sourcecodes/bnt-master/KPMstats/clg_prob.m @@ -0,0 +1,14 @@ +function p = eval_pdf_clg(X,Y,mu,Sigma,W) +% function p = eval_pdf_clg(X,Y,mu,Sigma,W) +% +% p(c,t) = N(Y(:,t); mu(:,c) + W(:,:,c)*X(:,t), Sigma(:,:,c)) + +[d T] = size(Y); +[d nc] = size(mu); +p = zeros(nc,T); +for c=1:nc + denom = (2*pi)^(d/2)*sqrt(abs(det(Sigma(:,:,c)))); + M = repmat(mu(:,c), 1, T) + W(:,:,c)*X; + mahal = sum(((Y-M)'*inv(Sigma(:,:,c))).*(Y-M)',2); + p(c,:) = (exp(-0.5*mahal) / denom)'; +end |
