1 function [EigenvectorsDiscrete,EigenVectors]=discretisation(EigenVectors)
\r
3 % EigenvectorsDiscrete=discretisation(EigenVectors)
\r
5 % Input: EigenVectors = continuous Ncut vector, size = ndata x nbEigenvectors
\r
6 % Output EigenvectorsDiscrete = discrete Ncut vector, size = ndata x nbEigenvectors
\r
8 % Timothee Cour, Stella Yu, Jianbo Shi, 2004
\r
10 [n,k]=size(EigenVectors);
\r
12 vm = sqrt(sum(EigenVectors.*EigenVectors,2));
\r
13 EigenVectors = EigenVectors./repmat(vm,1,k);
\r
16 R(:,1)=EigenVectors(1+round(rand(1)*(n-1)),:)';
\r
19 c=c+abs(EigenVectors*R(:,j-1));
\r
21 R(:,j)=EigenVectors(i,:)';
\r
24 lastObjectiveValue=0;
\r
26 nbIterationsDiscretisation = 0;
\r
27 nbIterationsDiscretisationMax = 20;%voir
\r
29 nbIterationsDiscretisation = nbIterationsDiscretisation + 1 ;
\r
30 EigenvectorsDiscrete = discretisationEigenVectorData(EigenVectors*R);
\r
31 [U,S,V] = svd(EigenvectorsDiscrete'*EigenVectors,0);
\r
32 NcutValue=2*(n-trace(S));
\r
34 if abs(NcutValue-lastObjectiveValue) < eps | nbIterationsDiscretisation > nbIterationsDiscretisationMax
\r
37 lastObjectiveValue = NcutValue;
\r