   function ctrs = getCentroids(X, idx, nC)
%% function ctrs = getCentroids(X, idx, nC)    
%% computes centroids given labels (idx)
  [m n] = size(X);
  ctrs = zeros(nC, n);
  for i=1:nC
      xi = X(idx==i,:);
      ctrs(i,:) = mean(xi);
  end

