gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool

#include <daFunk.hpp>

Collaboration diagram for daFunk::FunkBound:

Public Member Functions

 FunkBound (Funk f, size_t datalen, size_t bindID)
 
 ~FunkBound ()
 
double value (std::vector< double > &map, size_t bindID)
 
template<typename... Args>
double eval (Args... argss)
 
template<typename... Args>
std::vector< doublevect (Args... argss)
 

Private Member Functions

template<typename... Args>
std::vector< doublevect2 (std::vector< std::vector< double >> &coll)
 
template<typename... Args>
std::vector< doublevect2 (std::vector< std::vector< double >> &coll, double x, Args... argss)
 
template<typename... Args>
std::vector< doublevect2 (std::vector< std::vector< double >> &coll, std::vector< double > v, Args... argss)
 

Static Private Member Functions

static void bindID_manager (size_t &bindID, bool bind)
 

Private Attributes

Funk f
 
size_t datalen
 
size_t bindID
 

Friends

template<typename... Args>
shared_ptr< FunkBoundFunkBase::bind (Args... argss)
 

Detailed Description

Definition at line 392 of file daFunk.hpp.

Constructor & Destructor Documentation

◆ FunkBound()

daFunk::FunkBound::FunkBound ( Funk  f,
size_t  datalen,
size_t  bindID 
)
inline

Definition at line 395 of file daFunk.hpp.

395 : f(f), datalen(datalen), bindID(bindID) {};

◆ ~FunkBound()

daFunk::FunkBound::~FunkBound ( )
inline

Definition at line 396 of file daFunk.hpp.

396 {bindID_manager(bindID,false);};
static void bindID_manager(size_t &bindID, bool bind)
Definition: daFunk.hpp:417

Member Function Documentation

◆ bindID_manager()

static void daFunk::FunkBound::bindID_manager ( size_t &  bindID,
bool  bind 
)
inlinestaticprivate

Definition at line 417 of file daFunk.hpp.

References daFunk::livingVector::is_dead().

Referenced by daFunk::FunkBase::bind().

418  {
419  static size_t n_idx = 0;
420  static livingVector free;
421  if(bind)
422  {
423  #pragma omp critical (bindID_allocation)
424  {
425  if(free.empty())
426  {
427  // Increment after assignment (n_idx++ instead of ++n_idx)
428  bindID = n_idx++;
429  }
430  else
431  {
432  bindID = free.back();
433  free.pop_back();
434  }
435  }
436  }
437  else
438  {
439  if ( not livingVector::is_dead() )
440  {
441  #pragma omp critical (bindID_allocation)
442  free.push_back(bindID);
443  }
444  }
445  }
static bool & is_dead()
Definition: daFunk.hpp:385
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eval()

template<typename... Args>
double daFunk::FunkBound::eval ( Args...  argss)
inline

Definition at line 399 of file daFunk.hpp.

References Gambit::GreAT::data, and f.

400  {
401  auto data = vec<double>(argss...);
402  data.resize(datalen);
403  return f->value(data, bindID);
404  }
greatScanData data
Definition: great.cpp:38

◆ value()

double daFunk::FunkBound::value ( std::vector< double > &  map,
size_t  bindID 
)
inline

Definition at line 397 of file daFunk.hpp.

References void.

397 {(void)bindID; (void)map; return 0;};
hb_ModelParameters void

◆ vect()

template<typename... Args>
std::vector<double> daFunk::FunkBound::vect ( Args...  argss)
inline

Definition at line 406 of file daFunk.hpp.

References daFunk::FunkBase::bind().

407  {
408  std::vector<std::vector<double>> coll;
409  return this->vect2(coll, argss...);
410  }
std::vector< double > vect2(std::vector< std::vector< double >> &coll)
Definition: daFunk.hpp:446
Here is the call graph for this function:

◆ vect2() [1/3]

template<typename... Args>
std::vector<double> daFunk::FunkBound::vect2 ( std::vector< std::vector< double >> &  coll)
inlineprivate

Definition at line 446 of file daFunk.hpp.

References Gambit::GreAT::data, f, and r.

447  {
448  size_t size = 1;
449  std::vector<bool> vec_flag;
450  for ( auto it = coll.begin(); it != coll.end(); ++it )
451  {
452  if ( it->size() == 1 )
453  {
454  vec_flag.push_back(false);
455  continue;
456  }
457  vec_flag.push_back(true);
458  if ( size == 1 ) size = it->size();
459  if ( size != it->size() )
460  {
461  std::cerr << "daFunk::FunkBase WARNING: Inconsistent vector lengths." << std::endl;
462  return vec<double>();
463  }
464  }
465  auto r = vec<double>();
466  auto data = vec<double>();
467  data.resize(datalen);
468  for ( size_t i = 0; i != size; ++i )
469  {
470  for ( size_t j = 0; j != coll.size(); ++j )
471  {
472  if ( vec_flag[j] )
473  data[j] = coll[j][i];
474  else
475  data[j] = coll[j][0];
476  }
477  r.push_back(f->value(data, bindID));
478  }
479  return r;
480  }
greatScanData data
Definition: great.cpp:38
START_MODEL dNur_CMB r

◆ vect2() [2/3]

template<typename... Args>
std::vector<double> daFunk::FunkBound::vect2 ( std::vector< std::vector< double >> &  coll,
double  x,
Args...  argss 
)
inlineprivate

Definition at line 482 of file daFunk.hpp.

483  {
484  coll.push_back(vec<double>(x));
485  return this->vect2(coll, argss...);
486  }
std::vector< double > vect2(std::vector< std::vector< double >> &coll)
Definition: daFunk.hpp:446

◆ vect2() [3/3]

template<typename... Args>
std::vector<double> daFunk::FunkBound::vect2 ( std::vector< std::vector< double >> &  coll,
std::vector< double v,
Args...  argss 
)
inlineprivate

Definition at line 488 of file daFunk.hpp.

489  {
490  coll.push_back(v);
491  return this->vect2(coll, argss...);
492  }
std::vector< double > vect2(std::vector< std::vector< double >> &coll)
Definition: daFunk.hpp:446

Friends And Related Function Documentation

◆ FunkBase::bind

template<typename... Args>
shared_ptr<FunkBound> FunkBase::bind ( Args...  argss)
friend

Member Data Documentation

◆ bindID

size_t daFunk::FunkBound::bindID
private

Definition at line 504 of file daFunk.hpp.

◆ datalen

size_t daFunk::FunkBound::datalen
private

Definition at line 499 of file daFunk.hpp.

◆ f

Funk daFunk::FunkBound::f
private

Definition at line 494 of file daFunk.hpp.


The documentation for this class was generated from the following file: