function Q = perform_entropy(W_int);

x=W_int(:);
N=length(x);

if (max(x)==min(x))
    Q = 0;
else
    hw = hist(x,min(x):max(x));
    hw = hw/sum(hw); % calcul de l'histogramme
    ids=find(hw);
    Q = -sum(hw(ids).*log2(hw(ids))) * N; % compute the entropy
end
