function R = findMapping(X, Means)
% function R = findMapping(X, Means)
%
% Finds mapping for data matrix X and mean vectors Means

n = size(X, 1);
k = size(Means, 1);
[foo, y] = min(dist(X', Means')');
R = sparse(1:n, y, ones(1, n), n, k);


% long version
% R1 = zeros(n,k);
% for i=1:n
%     actDist = zeros(k,1);
%     for j=1:k
%         actDist(j) = norm(X(i,:) - Means(j,:));
%     end
%     [foo,y] = min(actDist);
%     R1(i,y) = 1;
% end