Reputation: 960
I need to generate(in matlab) L points in d-dimensional space which has to satisfies the condition that distance between any two points in the set D (defined below) is above some given threshold r.
The set D ={ L Union Combination of L}. The other various combination of L are generated as its average. For example, the combination of point 1,5,6 is generated as (point_1 + point_5 + point_6)/3, similarly the combination 1,2,5,6 is generated as (point_1 + point_2 + point_5 + point_6)/4.
In general, the set D will have $\sum_{i=1}^{L} L C_{i}$ points.
Upvotes: 1
Views: 885
Reputation: 16035
I made a code that (I think) do what you explain, tell me what you think.
nL=6;
d=2;
r=0.1;
L=rand(d,nL); %%% generate nL random d-dimentional points
Lfinal=[];
for nn=1:nL %% for all passible size of subset of (1:nL)
sets=nchoosek(1:nL,nn); %% all sub-set of 1:nL of size nn
Ls=reshape(L(:,sets'),d,nn,[]); %% the corresponding Ls
newL=squeeze(sum(Ls,2))/nn; %% their sums
Lfinal=[Lfinal newL]; %% concatante to the final set of Ls.
end
L=Lfinal;
dists=pdist2(L',L'); %%% compute the distances between each point
dists(dists==0)=inf; %%% fill the diagonal with infinity to not use the distance between a point and it self
L=L*r/min(dists(:)); %%% multiply the points by "r/min(dists(:))" to make sure all points are at leat at distance r
L
Upvotes: 1