function [I] = HoopStats_InfoContent(P,K)
% "HoopStats_K2H"
% R02.00
% By Sam Berens (sam.berens@york.ac.uk).
%
% Computes the information content (I) of a von Mises distribution with a
% prior weight of P and a concentration parameter of K.
%
% [I] = HoopStats_InfoContent(P,K)

if (numel(P) == 1) && (numel(K) > 1)
    P = ones(size(K)) .* P;
elseif (numel(K) == 1) && (numel(P) > 1)
    K = ones(size(P)) .* K;
elseif numel(P) ~= numel(K)
    error('[(numel(P)==numel(K)) || numel(P)==1 || numel(K)==1] must be true.');
end

MaxH = log(2*pi);
I = nan(size(P));
for iE = 1:1:numel(P)
    cP = P(iE);
    cK = K(iE);
    if (cK == 0) || (cP == 0)
        I(iE) = 0;
    else
        I(iE) = MaxH - ((cP.*HoopStats_K2H(cK))+(MaxH.*(1-cP)));
    end
end

return