barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
typedefs.hpp File Reference
#include "barry-configuration.hpp"
#include "barry-debug.hpp"
#include "progress.hpp"
Include dependency graph for typedefs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Entries< Cell_Type >
 A wrapper class to store source, target, val from a BArray object. More...
 
struct  vecHasher< T >
 

Namespaces

 CHECK
 Integer constants used to specify which cell should be check.
 
 EXISTS
 Integer constants used to specify which cell should be check to exist or not.
 

Typedefs

typedef std::vector< std::pair< std::vector< double >, size_t > > Counts_type
 
template<typename Cell_Type >
using Row_type = Map< size_t, Cell< Cell_Type > >
 
template<typename Cell_Type >
using Col_type = Map< size_t, Cell< Cell_Type > * >
 
template<typename Ta = double, typename Tb = size_t>
using MapVec_type = std::unordered_map< std::vector< Ta >, Tb, vecHasher< Ta > >
 
template<typename Array_Type , typename Data_Type >
using Hasher_fun_type = std::function< std::vector< double >(const Array_Type &, Data_Type *)>
 Hasher function used by the counter. More...
 
template<typename Array_Type , typename Data_Type >
using Counter_fun_type = std::function< double(const Array_Type &, size_t, size_t, Data_Type &)>
 Counter and rule functions. More...
 
template<typename Array_Type , typename Data_Type >
using Rule_fun_type = std::function< bool(const Array_Type &, size_t, size_t, Data_Type &)>
 

Functions

std::vector< size_t > sort_array (const double *v, size_t start, size_t ncols, size_t nrows)
 Ascending sorting an array. More...
 
template<typename T >
vec_inner_prod (const T *a, const T *b, size_t n)
 
template<>
double vec_inner_prod (const double *a, const double *b, size_t n)
 
template<typename T >
bool vec_equal (const std::vector< T > &a, const std::vector< T > &b)
 Compares if -a- and -b- are equal. More...
 
template<typename T >
bool vec_equal_approx (const std::vector< T > &a, const std::vector< T > &b, double eps=1e-100)
 

Variables

const int CHECK::BOTH = -1
 
const int CHECK::NONE = 0
 
const int CHECK::ONE = 1
 
const int CHECK::TWO = 2
 
const int EXISTS::BOTH = -1
 
const int EXISTS::NONE = 0
 
const int EXISTS::ONE = 1
 
const int EXISTS::TWO = 1
 
const int EXISTS::UKNOWN = -1
 
const int EXISTS::AS_ZERO = 0
 
const int EXISTS::AS_ONE = 1
 

Typedef Documentation

◆ Col_type

template<typename Cell_Type >
using Col_type = Map< size_t, Cell<Cell_Type>* >

Definition at line 70 of file typedefs.hpp.

◆ Counter_fun_type

template<typename Array_Type , typename Data_Type >
using Counter_fun_type = std::function<double(const Array_Type &, size_t, size_t, Data_Type &)>

Counter and rule functions.

Parameters
Array_Typea BArray
unit,size_tFocal cell
Data_TypeData associated with the function, for example, id of the attribute in the Array.
Returns
Counter_fun_type a double (the change statistic)
Rule_fun_type a bool. True if the cell is blocked.

Definition at line 187 of file typedefs.hpp.

◆ Counts_type

typedef std::vector< std::pair< std::vector<double>, size_t > > Counts_type

Definition at line 51 of file typedefs.hpp.

◆ Hasher_fun_type

template<typename Array_Type , typename Data_Type >
using Hasher_fun_type = std::function<std::vector<double>(const Array_Type &, Data_Type *)>

Hasher function used by the counter.

Used to characterize the support of the array.

Template Parameters
Array_Type

Definition at line 200 of file typedefs.hpp.

◆ MapVec_type

template<typename Ta = double, typename Tb = size_t>
using MapVec_type = std::unordered_map< std::vector< Ta >, Tb, vecHasher<Ta> >

Definition at line 128 of file typedefs.hpp.

◆ Row_type

template<typename Cell_Type >
using Row_type = Map< size_t, Cell<Cell_Type> >

Definition at line 67 of file typedefs.hpp.

◆ Rule_fun_type

template<typename Array_Type , typename Data_Type >
using Rule_fun_type = std::function<bool(const Array_Type &, size_t, size_t, Data_Type &)>

Definition at line 190 of file typedefs.hpp.

Function Documentation

◆ sort_array()

std::vector< size_t > sort_array ( const double *  v,
size_t  start,
size_t  ncols,
size_t  nrows 
)
inline

Ascending sorting an array.

It will sort an array solving ties using the next column. Data is stored column-wise.

Template Parameters
T
Parameters
v
nrows
Returns
std::vector<size_t> The sorting index.

Definition at line 141 of file typedefs.hpp.

◆ vec_equal()

template<typename T >
bool vec_equal ( const std::vector< T > &  a,
const std::vector< T > &  b 
)
inline

Compares if -a- and -b- are equal.

Parameters
a,bTwo vectors of the same length
Returns
true if all elements are equal.

Definition at line 210 of file typedefs.hpp.

◆ vec_equal_approx()

template<typename T >
bool vec_equal_approx ( const std::vector< T > &  a,
const std::vector< T > &  b,
double  eps = 1e-100 
)
inline

Definition at line 235 of file typedefs.hpp.

◆ vec_inner_prod() [1/2]

template<>
double vec_inner_prod ( const double *  a,
const double *  b,
size_t  n 
)
inline

Definition at line 286 of file typedefs.hpp.

◆ vec_inner_prod() [2/2]

template<typename T >
T vec_inner_prod ( const T *  a,
const T *  b,
size_t  n 
)
inline

Definition at line 263 of file typedefs.hpp.