32 #ifndef SHARK_RNG_ENTROPY_H 33 #define SHARK_RNG_ENTROPY_H 47 template<
typename Distribution>
48 double entropy( Distribution & d, std::size_t trials = 10000 ) {
50 throw(
shark::Exception(
"entropy: Trial count needs to be larger than 0.", __FILE__, __LINE__ ) );
53 for (
unsigned int i = 0; i < trials; i++ ) {
54 t += ::log( d.p( d() ) );
56 return( -t / trials );