Code covered by the BSD License  

Highlights from
Fast and efficient spectral clustering

image thumbnail

Fast and efficient spectral clustering

by

 

02 Jan 2012 (Updated )

Perform fast and efficient spectral clustering algorithms

convertClusterVector(M)
function indMatrix = convertClusterVector(M)
% CONVERTCLUSTERVECTOR
%   Converts between row vector with cluster number and indicator vector
%   matrix

if size(M, 2) > 1
    indMatrix = zeros(size(M, 1), 1);
    for ii = 1:size(M, 2)
        indMatrix(M(:, ii) == 1) = ii;
    end
else
    indMatrix = sparse(1:size(M, 1), M, 1);
end

Contact us