File misc.hpp¶
FileList > epiworld > misc.hpp
Go to the source code of this file
Classes¶
| Type | Name |
|---|---|
| struct | vecHasher <typename T> Vector hasher. |
Public Types¶
| Type | Name |
|---|---|
| typedef std::unordered_map< std::vector< Ta >, Tb, vecHasher< Ta > > | MapVec_type |
Public Functions¶
| Type | Name |
|---|---|
| bool | IN (const Ta & a, const std::vector< Ta > & b) noexcept Check whether a is included inb __ |
| TSeq | default_sequence (int seq_count) |
| bool | default_sequence (int seq_count) |
| int | default_sequence (int seq_count) |
| epiworld_double | default_sequence (int seq_count) |
| std::vector< bool > | default_sequence (int seq_count) |
| std::vector< int > | default_sequence (int seq_count) |
| std::vector< epiworld_double > | default_sequence (int seq_count) |
| To * | model_cast (Model< TSeq > * m) |
| std::map< std::string, T > | read_yaml (std::string fn) Read parameters from a yaml file. |
| int | roulette (const std::vector< TDbl > & probs, Model< TSeq > * m) Conditional Weighted Sampling. |
| int | roulette (std::vector< double > & probs, Model< TSeq > * m) |
| int | roulette (std::vector< float > & probs, Model< TSeq > * m) |
| int | roulette (epiworld_fast_uint nelements, Model< TSeq > * m) |
Macros¶
| Type | Name |
|---|---|
| define | EPI_ASSUME (cond) ((void)0)Cast a Model pointer to a specific model type. |
Public Types Documentation¶
typedef MapVec_type¶
Public Functions Documentation¶
function IN¶
Check whether a is included inb __
Template parameters:
TaType ofa. Could be int, epiworld_double, etc.
Parameters:
aScalar of classTa.bVectorstd::vectorof classTa.
Returns:
true if a in b, and false otherwise.
function default_sequence¶
function default_sequence¶
function default_sequence¶
function default_sequence¶
function default_sequence¶
function default_sequence¶
function default_sequence¶
function model_cast¶
function read_yaml¶
Read parameters from a yaml file.
The file should have the following structure:
Template parameters:
TType of the parameter
Parameters:
fnPath to the file containing the parameters
Returns:
std::map<std::string, T>
function roulette¶
Conditional Weighted Sampling.
template<typename TSeq, typename TDbl>
inline int roulette (
const std::vector< TDbl > & probs,
Model < TSeq > * m
)
The sampling function will draw one of {-1, 0,...,probs.size() - 1} in a weighted fashion. The probabilities are drawn given that either one or none of the cases is drawn; in the latter returns -1.
Parameters:
probsVector of probabilities.mAModel. This is used to draw random uniform numbers.
Returns:
int If -1 then it means that none got sampled, otherwise the index of the entry that got drawn.
function roulette¶
function roulette¶
function roulette¶
Macro Definition Documentation¶
define EPI_ASSUME¶
Cast a Model pointer to a specific model type.
The documentation for this class was generated from the following file epiworld-src/include/epiworld/misc.hpp