function kld = KL_div(p,q)

    kld = sum( -p(:).*log(q(:)) + p(:).*log(p(:)) );

end