ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Entropy.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*----------------------------- File Entropy.h -----------------------------*/
3/*--------------------------------------------------------------------------*/
44/*--------------------------------------------------------------------------*/
45/*----------------------------- DEFINITIONS --------------------------------*/
46/*--------------------------------------------------------------------------*/
47
48#ifndef __ADS_Entropy
49 #define __ADS_Entropy
50/* self-identification: #endif constant */
51
52/*--------------------------------------------------------------------------*/
53/*------------------------------ INCLUDES ----------------------------------*/
54/*--------------------------------------------------------------------------*/
55
56#include "ADS/Contract.h"
57
58#include <cmath>
59#include <cstddef>
60#include <map>
61#include <string>
62#include <string_view>
63
64/*--------------------------------------------------------------------------*/
65/*--------------------------- NAMESPACE ------------------------------------*/
66/*--------------------------------------------------------------------------*/
67
68namespace ADS
69{
70
86template< class C , class F >
87[[nodiscard]] double entropy( const std::map< C , F > & freq );
88
101[[nodiscard]] inline double entropy( std::string_view s );
102
123[[nodiscard]] inline double entropy( std::string_view s , std::size_t k );
124
125/*--------------------------------------------------------------------------*/
126
127} // end( namespace ADS )
128
129/*--------------------------------------------------------------------------*/
130/*-------------------------- IMPLEMENTATION --------------------------------*/
131/*--------------------------------------------------------------------------*/
132
133#include "ADS/compression/impl/Entropy.tpp"
134
135/*--------------------------------------------------------------------------*/
136
137#endif /* Entropy.h included */
138
139/*--------------------------------------------------------------------------*/
140/*--------------------------- End File Entropy.h ---------------------------*/
141/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
double entropy(const std::map< C, F > &freq)
the entropy of order 0, in bits per symbol, of the distribution proportional to the frequencies of f...
Definition ADT.h:96