function [LUT, M] = mykmeans(S, k)
    [LUT, M] = step1_initialization(S, k);
    eps = 1;
    t = 1;
    
    while eps>= 0.02 & t <100
        M_old = M;
        LUT = step2_assignment(S, k, LUT, M);
        M = step3_update(S, k, LUT, M);
        eps = sum((M-M_old).^2);
        t = t + 1;
    end



    fprintf('Iteration finished after %d steps.\n', t);

end
