Added source Matlab code for reference

This commit is contained in:
Waldir Leoncio 2019-12-16 16:47:21 +01:00
parent b8af977117
commit b5d99903d2
186 changed files with 61405 additions and 1 deletions

View file

@ -0,0 +1,17 @@
function srt_partition = sort_partition(partition)
% SORT_PARTITION sorts a given partition (row vector) into the canonical order, where every
% new class has the smallest possible index.
% input:
% partition is a column vector.
% output:
% srt_partition is a row vector.
n_classes=max(partition);
srt_partition=zeros(1,n_classes);
for i=1:n_classes
nonz=find(partition);
here=find(partition==partition(nonz(1)));
srt_partition(here)=i;
partition(here)=0;
end