![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
About aGrUM utilities. More...
About aGrUM utilities.
Modules | |
Math | |
All the maths you'll need. | |
Configuration | |
About aGrUM configuration. | |
Smart Pointers | |
RefPtr are a replacement for the usual pointers: they keep track of the number of "smart" pointers pointing to a given element. | |
Classes | |
class | gum::Directory |
Cross-platform directory utility. More... | |
template<typename T1 , typename T2 > | |
ostream & | std::operator<< (ostream &stream, const pair< T1, T2 > &val) |
'std::cout<<' operator for pairs. More... | |
template<typename T0 , typename... T> | |
std::ostream & | std::operator<< (std::ostream &os, const std::tuple< T0, T... > &t) |
'std::cout<<' operator for vectors. More... | |
template<typename T > | |
ostream & | std::operator<< (ostream &stream, const vector< T > &val) |
'std::cout<<' operator for vectors. More... | |
template<typename T > | |
bool | std::hasUniqueElts (std::vector< T > const &x) |
template<typename T1 , typename T2 > | |
using | gum::forbidden_type = typename std::enable_if< !std::is_same< T1, T2 >::value, int >::type |
Forbidden_type<T1,T2> return the "int" type if T1 and T2 are of the same type, else nothing. More... | |
bool | gum::Memcmp (const void *const in_, const void *const out_, unsigned long size) |
Cross-platform replacement for memcmp. More... | |
void | gum::_atexit_ () |
Used for debug purpose. More... | |
Idx | gum::randomValue (const Size max=2) |
Returns a random Idx between 0 and max-1 included. More... | |
double | gum::randomProba () |
Returns a random double between 0 and 1 included (i.e. More... | |
template<typename GUM_SCALAR > | |
std::vector< GUM_SCALAR > | gum::randomDistribution (Size n) |
Return a random discrete distribution. More... | |
unsigned int | gum::randomGeneratorSeed () |
Returns the aGrUM's seed used by the std::generators. More... | |
void | gum::initRandom (unsigned int seed=0) |
Initialize random generator seed. More... | |
std::default_random_engine | gum::getRandomGenerator (unsigned int seed=0) |
define a random_engine with correct seed More... | |
std::string | gum::getUniqueFileName () |
Returns a path to a unique file name. More... | |
bool | gum::endsWith (std::string const &value, std::string const &ending) |
Returns true if value ends with ending. More... | |
std::vector< std::string > | gum::split (const std::string &orig, const std::string &delimiter) |
Split str using the delimiter. More... | |
std::string | gum::replace (const std::string &s, const std::string &val, const std::string &new_val) |
not usable for gcc 4.8 std::vector<std::string> split( const std::string& orig, const std::string& delimiter ) { More... | |
std::string | gum::toLower (std::string str) |
Returns the lowercase version of str. More... | |
using gum::forbidden_type = typedef typename std::enable_if< !std::is_same< T1, T2 >::value, int >::type |
Forbidden_type<T1,T2> return the "int" type if T1 and T2 are of the same type, else nothing.
Use it as a guard in template specification :
T1 | The type to test for. |
T2 | The expected type. |
Definition at line 123 of file utils_misc.h.
void gum::_atexit_ | ( | ) |
bool gum::endsWith | ( | std::string const & | value, |
std::string const & | ending | ||
) |
Returns true if value ends with ending.
Definition at line 49 of file utils_string.cpp.
std::default_random_engine gum::getRandomGenerator | ( | unsigned int | seed | ) |
define a random_engine with correct seed
Definition at line 47 of file utils_random.cpp.
std::string gum::getUniqueFileName | ( | ) |
Returns a path to a unique file name.
Definition at line 36 of file utils_string.cpp.
bool std::hasUniqueElts | ( | std::vector< T > const & | x | ) |
check if a vector consists in unique values (no duplicate).
T | The vector's elements type. |
x | the vector |
Definition at line 87 of file utils_misc_tpl.h.
INLINE void gum::initRandom | ( | unsigned int | seed = 0 | ) |
Initialize random generator seed.
Definition at line 40 of file utils_random_inl.h.
References gum::Set< Key, Alloc >::emplace().
bool gum::Memcmp | ( | const void *const | in_, |
const void *const | out_, | ||
unsigned long | size | ||
) |
Cross-platform replacement for memcmp.
in_ | A pointer to the block of memory to copy. |
out_ | A pointer to the block of memory receiving copy. |
size | Number of bytes to copy. |
Definition at line 37 of file utils_misc.cpp.
ostream & std::operator<< | ( | ostream & | stream, |
const pair< T1, T2 > & | val | ||
) |
'std::cout<<' operator for pairs.
T1 | The pair's first's type. |
T2 | The pair's second's type. |
stream | The stream to print to. |
val | The pair to print to stream. |
Definition at line 58 of file utils_misc_tpl.h.
std::ostream & std::operator<< | ( | std::ostream & | os, |
const std::tuple< T0, T... > & | t | ||
) |
'std::cout<<' operator for vectors.
stream | The stream to print to. |
t | The std::tuple |
val | The std::vector to print to stream. |
Definition at line 79 of file utils_misc_tpl.h.
ostream & std::operator<< | ( | ostream & | stream, |
const vector< T > & | val | ||
) |
'std::cout<<' operator for vectors.
T | The vector's elements type. |
stream | The stream to print to. |
val | The std::vector to print to stream. |
Definition at line 40 of file utils_misc_tpl.h.
std::vector< GUM_SCALAR > gum::randomDistribution | ( | Size | n | ) |
Return a random discrete distribution.
n | The number of modalities for the ditribution. |
GUM_SCALAR | The type used for representing probabilities. |
Definition at line 34 of file utils_random_tpl.h.
unsigned int gum::randomGeneratorSeed | ( | ) |
Returns the aGrUM's seed used by the std::generators.
Definition at line 40 of file utils_random.cpp.
INLINE double gum::randomProba | ( | ) |
Returns a random double between 0 and 1 included (i.e.
a proba).
Definition at line 37 of file utils_random_inl.h.
References gum::Set< Key, Alloc >::emplace().
Returns a random Idx between 0 and max-1 included.
Definition at line 34 of file utils_random_inl.h.
References gum::Set< Key, Alloc >::emplace().
std::string gum::replace | ( | const std::string & | s, |
const std::string & | val, | ||
const std::string & | new_val | ||
) |
not usable for gcc 4.8 std::vector<std::string> split( const std::string& orig, const std::string& delimiter ) {
Replace val by new_val in s.
std::regex rgx( delimiter );
std::sregex_token_iterator first{begin( orig ), end( orig ), rgx, -1}, last;
return {first, last}; }
s | A string. |
val | The value to replace in s. |
new_val | The new value to replace val in s. |
Definition at line 78 of file utils_string.cpp.
std::vector< std::string > gum::split | ( | const std::string & | orig, |
const std::string & | delimiter | ||
) |
Split str using the delimiter.
orig | searched string |
delimiter | string |
Definition at line 54 of file utils_string.cpp.
INLINE std::string gum::toLower | ( | std::string | str | ) |
Returns the lowercase version of str.
Definition at line 36 of file utils_string_inl.h.
References gum::Set< Key, Alloc >::emplace().