ATLAS Offline Software
Classes | Functions
conifer Namespace Reference

Classes

class  BDT
 
class  DecisionTree
 
class  OpAdd
 

Functions

constexpr int floorlog2 (int x)
 
template<int B>
constexpr int pow (int x)
 
constexpr int pow2 (int x)
 
template<class T , class Op >
reduce (std::vector< T > x, Op op)
 

Function Documentation

◆ floorlog2()

constexpr int conifer::floorlog2 ( int  x)
constexpr

Definition at line 18 of file conifer.h.

18 { return (x < 2) ? 0 : 1 + floorlog2(x / 2); }

◆ pow()

template<int B>
constexpr int conifer::pow ( int  x)
constexpr

Definition at line 20 of file conifer.h.

20  {
21  return x == 0 ? 1 : B * pow<B>(x - 1);
22 }

◆ pow2()

constexpr int conifer::pow2 ( int  x)
constexpr

Definition at line 24 of file conifer.h.

24 { return pow<2>(x); }

◆ reduce()

template<class T , class Op >
T conifer::reduce ( std::vector< T >  x,
Op  op 
)

Definition at line 26 of file conifer.h.

26  {
27  int N = x.size();
28  int leftN = pow2(floorlog2(N - 1)) > 0 ? pow2(floorlog2(N - 1)) : 0;
29  // static constexpr int rightN = N - leftN > 0 ? N - leftN : 0;
30  if (N == 1) {
31  return x.at(0);
32  } else if (N == 2) {
33  return op(x.at(0), x.at(1));
34  } else {
35  std::vector<T> left(x.begin(), x.begin() + leftN);
36  std::vector<T> right(x.begin() + leftN, x.end());
37  return op(reduce<T, Op>(left, op), reduce<T, Op>(right, op));
38  }
39 }
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
x
#define x
conifer::floorlog2
constexpr int floorlog2(int x)
Definition: conifer.h:18
conifer::pow2
constexpr int pow2(int x)
Definition: conifer.h:24
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110