barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
network-css.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CSS_SIZE()
 
#define CSS_MATCH_TYPE()
 
#define CSS_CASE_TRUTH()   if ((i < n) && (j < n))
 
#define CSS_TRUE_CELLS()
 
#define CSS_CASE_PERCEIVED()   else if (((i >= s) && (i < e)) & ((j >= s) && (j < e)))
 
#define CSS_PERCEIVED_CELLS()
 
#define CSS_CASE_ELSE()
 
#define CSS_CHECK_SIZE_INIT()
 
#define CSS_CHECK_SIZE()
 
#define CSS_APPEND(name)
 
#define CSS_NET_COUNTER_LAMBDA_INIT()
 

Functions

template<typename Tnet = Network>
void counter_css_partially_false_recip_commi (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 Counts errors of commission. More...
 
template<typename Tnet = Network>
void counter_css_partially_false_recip_omiss (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 Counts errors of omission. More...
 
template<typename Tnet = Network>
void counter_css_completely_false_recip_comiss (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 Counts completely false reciprocity (comission) More...
 
template<typename Tnet = Network>
void counter_css_completely_false_recip_omiss (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 Counts completely false reciprocity (omission) More...
 
template<typename Tnet = Network>
void counter_css_mixed_recip (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 Counts mixed reciprocity errors. More...
 
template<typename Tnet = Network>
void counter_css_census01 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census02 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census03 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census04 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census05 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census06 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census07 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census08 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census09 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 
template<typename Tnet = Network>
void counter_css_census10 (NetCounters< Tnet > *counters, size_t netsize, const std::vector< size_t > &end_, size_t counter_type=0u)
 

Macro Definition Documentation

◆ CSS_APPEND

#define CSS_APPEND (   name)
Value:
std::string name_ = (name);\
for (size_t i = 0u; i < end_.size(); ++i) { \
std::string tmpname = name_ + " (" + std::to_string(i) + ")" + \
((counter_type == 1u) ? " (only perceiver)" : ((counter_type == 2u)? " (only alters)": ""));\
counters->add_counter(tmp_count, tmp_init, nullptr, \
NetCounterData({netsize, i == 0u ? netsize : end_[i-1], end_[i], counter_type, i}, {}),\
tmpname);}
Data class used to store arbitrary size_t or double vectors.
Definition: network.hpp:56
Data_Type &&counter_ name(std::move(counter_.name))
Data_Type Counter_fun_type< Array_Type, Data_Type > Hasher_fun_type< Array_Type, Data_Type > Data_Type std::string name_
size_t i

Definition at line 81 of file network-css.hpp.

◆ CSS_CASE_ELSE

#define CSS_CASE_ELSE ( )

Definition at line 66 of file network-css.hpp.

◆ CSS_CASE_PERCEIVED

#define CSS_CASE_PERCEIVED ( )    else if (((i >= s) && (i < e)) & ((j >= s) && (j < e)))

Definition at line 48 of file network-css.hpp.

◆ CSS_CASE_TRUTH

#define CSS_CASE_TRUTH ( )    if ((i < n) && (j < n))

Definition at line 32 of file network-css.hpp.

◆ CSS_CHECK_SIZE

#define CSS_CHECK_SIZE ( )
Value:
for (size_t i = 0u; i < end_.size(); ++i) {\
if (i == 0u) continue; \
else if (end_[i] < end_[i-1u]) \
throw std::logic_error("Endpoints should be specified in order.");}

Definition at line 76 of file network-css.hpp.

◆ CSS_CHECK_SIZE_INIT

#define CSS_CHECK_SIZE_INIT ( )
Value:
/* The indices fall within the network */ \
if ((data.indices.at(0) > Array.ncol()) \
| (data.indices.at(2) > Array.ncol())) \
throw std::range_error("The network does not match the prescribed size.");
Data_Type &&counter_ data(std::move(counter_.data))

Definition at line 70 of file network-css.hpp.

◆ CSS_MATCH_TYPE

#define CSS_MATCH_TYPE ( )
Value:
if (ctype != 0u) { /* all counts */ \
if (ctype == 1u) { /* Only if perceiver */ \
if ((i_ != ego_id) && (j_ != ego_id)) return 0.0; \
} else if (ctype == 2u) { /* Only if not perceiver */ \
if ((i_ == ego_id) || (j_ == ego_id)) return 0.0; \
} \
};

Definition at line 22 of file network-css.hpp.

◆ CSS_NET_COUNTER_LAMBDA_INIT

#define CSS_NET_COUNTER_LAMBDA_INIT ( )
Value:
CSS_CHECK_SIZE_INIT() \
return 0.0; \
};
#define NETWORK_COUNTER_LAMBDA(a)
Definition: network.hpp:119

Definition at line 89 of file network-css.hpp.

◆ CSS_PERCEIVED_CELLS

#define CSS_PERCEIVED_CELLS ( )
Value:
size_t i_ = i - s; \
size_t j_ = j - s; \
CSS_MATCH_TYPE() \
double tji = static_cast<double>(Array(j - s, i - s, false)); \
double pji = static_cast<double>(Array(j, i, false)); \
double tij = static_cast<double>(Array(i - s, j - s, false));
size_t size_t j

Definition at line 55 of file network-css.hpp.

◆ CSS_SIZE

#define CSS_SIZE ( )
Value:
size_t n = data.indices[0u]; \
size_t s = data.indices[1u]; \
size_t e = data.indices[2u]; \
size_t ctype = data.indices[3u]; \
size_t ego_id = data.indices[4u]; \
if (ctype > 2) \
throw std::range_error("Counter type should be 0, 1, or 2.");

Definition at line 8 of file network-css.hpp.

◆ CSS_TRUE_CELLS

#define CSS_TRUE_CELLS ( )
Value:
size_t i_ = i; \
size_t j_ = j; \
CSS_MATCH_TYPE() \
double tji = static_cast<double>(Array(j, i, false)); \
double pij = static_cast<double>(Array(i + s, j + s, false)); \
double pji = static_cast<double>(Array(j + s, i + s, false));

Definition at line 39 of file network-css.hpp.

Function Documentation

◆ counter_css_census01()

template<typename Tnet = Network>
void counter_css_census01 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 324 of file network-css.hpp.

◆ counter_css_census02()

template<typename Tnet = Network>
void counter_css_census02 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 389 of file network-css.hpp.

◆ counter_css_census03()

template<typename Tnet = Network>
void counter_css_census03 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 429 of file network-css.hpp.

◆ counter_css_census04()

template<typename Tnet = Network>
void counter_css_census04 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 469 of file network-css.hpp.

◆ counter_css_census05()

template<typename Tnet = Network>
void counter_css_census05 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 509 of file network-css.hpp.

◆ counter_css_census06()

template<typename Tnet = Network>
void counter_css_census06 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 549 of file network-css.hpp.

◆ counter_css_census07()

template<typename Tnet = Network>
void counter_css_census07 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 589 of file network-css.hpp.

◆ counter_css_census08()

template<typename Tnet = Network>
void counter_css_census08 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 629 of file network-css.hpp.

◆ counter_css_census09()

template<typename Tnet = Network>
void counter_css_census09 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 669 of file network-css.hpp.

◆ counter_css_census10()

template<typename Tnet = Network>
void counter_css_census10 ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Definition at line 709 of file network-css.hpp.

◆ counter_css_completely_false_recip_comiss()

template<typename Tnet = Network>
void counter_css_completely_false_recip_comiss ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Counts completely false reciprocity (comission)

Definition at line 200 of file network-css.hpp.

◆ counter_css_completely_false_recip_omiss()

template<typename Tnet = Network>
void counter_css_completely_false_recip_omiss ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Counts completely false reciprocity (omission)

Definition at line 241 of file network-css.hpp.

◆ counter_css_mixed_recip()

template<typename Tnet = Network>
void counter_css_mixed_recip ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Counts mixed reciprocity errors.

Definition at line 282 of file network-css.hpp.

◆ counter_css_partially_false_recip_commi()

template<typename Tnet = Network>
void counter_css_partially_false_recip_commi ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Counts errors of commission.

Parameters
netsizeSize of the reference (true) network
end_Vector indicating one past the ending index of each network. (see details)
counter_typeSize_t indicating the type of counter to use. Possible values are: 0: Count all, 1: Only count if perceiver is involved, and 2: Only count if perceiver is not involved.

The end_ parameter should be of length N of networks - 1. It is assumed that the first network ends at netsize.

Definition at line 107 of file network-css.hpp.

◆ counter_css_partially_false_recip_omiss()

template<typename Tnet = Network>
void counter_css_partially_false_recip_omiss ( NetCounters< Tnet > *  counters,
size_t  netsize,
const std::vector< size_t > &  end_,
size_t  counter_type = 0u 
)
inline

Counts errors of omission.

Definition at line 155 of file network-css.hpp.