function [subsetaveragewithin] = subset_aver_within(n,k)

% SUBSET_AVER_WITHIN produces a symmetric proximity matrix of size $n
% \times n$ that contains all zeros except for the $k \times k$
% upper-left-hand block (those off-diagonal entries are $1/(k*(k-1))$, to
% produce an average subset proximity value in a second matrix).
%
% syntax: [subsetaveragewithin] = subset_aver_within(n,k)

subsetaveragewithin = zeros(n,n);

for i = 1:k
    for j = 1:k
        
        if (i ~= j)
        
        subsetaveragewithin(i,j) = 1/(k*(k-1));
        
        end
        
    end
end