function [y_prd,y_mrg] = svmclassify(K,signed_alphas,b)
%
% Classify data after training
% K is assumed to be  n_trn x n_tst
%
% signed_alphas - expected to be 'alpha_i * y_i'
%
% (C) Gal Chechik 2005

  % Init
  n_tst = size(K,2);
  y_prd = zeros(n_tst,1);
  y_mrg = zeros(n_tst,1);
  sv_scale = max(log10(abs(signed_alphas)));
  svs = find(log10(abs(signed_alphas))>sv_scale-6);
  
  for i_tst=1:n_tst
    s=0;
    for sv=svs(:)'
      s = s + signed_alphas(sv) * K(sv,i_tst);
    end    
    y_mrg(i_tst) = s+b;
    y_prd(i_tst) = sign (s+b);
  end

  return
end