function [ll, ss, mask] = eval_fgmm(obs, gmms, verb);
% [logpr, seq, mask] = eval_fgmm(obs, gmms, verb);
%
% Evaluate factorial GMM probabilities and create binary masks using
% Sam Roweis' efficient branch and bound algorithm.
%
% Inputs:
%   obs  - matrix of observations.  Each column is a frame of data.
%   gmms - array of GMM structures
%
% Outputs:
%   logpr - MAP probability of each frame of data given the models
%   seq   - cell array containing the MAP sequence of GMM components
%           for each model
%   mask  - cell array of binary masks for each model that notate
%           the portions of obs that are explained by that model
%
% 2007-11-05 ronw@ee.columbia.edu

% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.

if nargin < 3,  verb = 0;  end


fgmm.nmix = reduce(@(x,y) x.nmix*y.nmix, gmms);

