function [gparm, status] = gmix_prune(gparm, effSampleWeight);
%function [gparm, status] = gmix_prune(gparm, effSampleWeight);
%
% status: 0 if no modes were prunes, 1 if one mode was pruned.
%
% Prune the mode with the single smallest weight, 
% but only when the effective numSamples < numFeatures.

%
% NAVAL UNDERSEA WARFARE CENTER
% class-specific@npt.nuwc.navy.mil
% http://www.npt.nuwc.navy.mil/csf
% Paul M. Baggenstoss
% 401-832-8240
% Do not disseminate.
%



status = 0;
wts = [gparm.modes.weight]';
% determine effective number of (segment) samples for each mode
nsamp_mode = wts * effSampleWeight;

[mw, iw] = min(nsamp_mode);
nFeat = length(gparm.features);
if ( mw < nFeat && length(nsamp_mode) > 1 )
    gparm.modes(iw) = [];
    status = 1;
    fprintf(['gmix_prune: pruning mode %d of %d with ' ...
        'effective sample weight of %f samples.\n'], ...
        iw, length(nsamp_mode), mw);
end
