function lhood = model_match(model, data)
% lhood = model_match(model, data)
%    Evaluate how well data fits model, returning total log likelihood.
% 2007-04-04

mmean = model.mean;
sigma = model.sigma;
prior = model.prior;

% gmm
if size(mmean,2) == 1
  %lhood = sum(log(gaussian_prob(data',mmean,sigma)));
  lhood = sum(gaussian_prob(data',mmean,sigma,1));
else
  lhood = sum(log(sum(mixgauss_prob(data',mmean,sigma,prior))));
end
