function map = datamap(data, r)
num = size(data, 2);
nb = zeros(size(data));
map = zeros(size(data));
for i = 1:num
    k = 0;
    for j = 1:num
        if(pd(data(:,i), data(:,j))<r)
            k = k+1;
            nb(:,k) = data(:,j);
        end
    end
    ons = ones(k, 1);
    map(:,i) = nb(:,1:k)'\ons;
end
