% check Gauss or Gauss-Markov ML cost for local minimums
%
% assumes that the symbols are -1 and +1
%
function count = get_ML_min()

global N;
global GM;

global pilot;
global pilot_index;

s = [-1; 1];
nsyms = size(s,1);
nstates = prod( nsyms*ones(1,N));	% nstates = nsyms ** N

c = ones( 1, N);

count = 0;

if( isempty(pilot))
  pb = [];
else
  pb = pilot(pilot_index);
end

for i = 1:nstates

  b = s(c);

  if( isempty(pb) | all( b(pilot_index) == pb) )

    if( GM)
      r = check_GM_ML_min( b);
    else
      r = check_Gauss_ML_min( b);
    end
 
    if( r)
      count = count + 1;
%      b'
    end

  end

  FSM_inc_C( c, nsyms);
  
end
