function [H] = HoopStats_K2H(K)
% "HoopStats_K2H"
% R01.01
% By Sam Berens (sam.berens@york.ac.uk).
%
% [H] = HoopStats_K2H(K)
%
% Computes the information entropy (H) of a von Mises distribution with a
% concentration parameter of K. If K is 0, H is maximal and reflects the
% information entropy of a uniform distribution;

%% Intergration:
% VonmPdf = @(Theta,Mu,K) exp(K.*cos(Theta-Mu)) ./ (2*pi*besseli(0,K));
% VonmWSu = @(Theta,Mu,K) VonmPdf(Theta,Mu,K).*log(VonmPdf(Theta,Mu,K));
% % VonmWSu is Weighted surprise;
% H = -1 * integral(@(Theta) VonmWSu(Theta,0,K),-pi,pi);

%% Direct computation:
VonmH = @(K) log(2.*pi.*besseli(0,K))-(K*(besseli(1,K)/besseli(0,K)));
H = VonmH(K);

return