www.gusucode.com > 用粒子滤波算法进行跟踪的matlab代码 > gmm_utilities/kernel_divide.m

    function gr = kernel_divide(g1,g2)
%
% gr = g1/g2
%
if length(g2.w) == 1
    gr = kernel_divide_gauss_denominator(g1, g2);
else
    gr = kernel_divide_kernel_denominator(g1, g2);
end

%
%

function gr = kernel_divide_gauss_denominator(g1, g2)
D = size(g1.x, 1);
M = size(g1.x, 2);

gr.w = zeros(1,M);
gr.x = zeros(D,M);

for i=1:M
    [gr.x(:,i), gr.P, w] = gauss_divide(g1.x(:,i), g1.P(:,:,i), g2.x, g2.P);
    gr.w(i) = g1.w * w;
end

%
%

function gr = kernel_divide_kernel_denominator(g1, g2)
warning('Approximate solution');

% Matt Ridley's division approximation for kernels.
% See Section 7.5 of his thesis.
%
% TODO, look at:
% - (approximately) factoring gaussian mixtures
% - the Fast Gauss Transform, does it offer insights?
% - automatic factoring of polynomials, is this a similar problem?