www.pudn.com > gmm_utilities.zip > gmm_conditional.m


function [g, c] = gmm_conditional(g, x, idx) 
% ALPHA VERSION 
% Deriving the conditional, given the joint, is found by considering a 
% perfect observation (ie, constraint) at x. 
% 
% In order to consider p(gmm|x) as a function of x, not just at x=x0, 
% this function returns c, the original cross-correlations of g. 
% 
% see also: Bar p123 
 
% TODO: A better way is to work this out longhand, and calculate directly,  
% but for now its easier to set it up as an observation. 
D = size(g.x, 1); 
Dc = size(x, 1); 
 
H = zeros(Dc, D); 
i = index_table(H, [1:Dc; idx]); 
H(i) = 1; 
 
gz.w = 1; 
gz.x = x; 
gz.P = zeros([Dc, Dc, 1]); 
 
g = gmm_update(g, gz, H); 
g = gmm_marginal(g, setdiff(1:D, idx));