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 25 of file conifer.h.

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

◆ pow()

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

Definition at line 27 of file conifer.h.

27  {
28  return x == 0 ? 1 : B * pow<B>(x - 1);
29 }

◆ pow2()

constexpr int conifer::pow2 ( int  x)
constexpr

Definition at line 31 of file conifer.h.

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

◆ reduce()

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

Definition at line 33 of file conifer.h.

33  {
34  int N = x.size();
35  int leftN = pow2(floorlog2(N - 1)) > 0 ? pow2(floorlog2(N - 1)) : 0;
36  // static constexpr int rightN = N - leftN > 0 ? N - leftN : 0;
37  if (N == 1) {
38  return x.at(0);
39  } else if (N == 2) {
40  return op(x.at(0), x.at(1));
41  } else {
42  std::vector<T> left(x.begin(), x.begin() + leftN);
43  std::vector<T> right(x.begin() + leftN, x.end());
44  return op(reduce<T, Op>(std::move(left), op), reduce<T, Op>(std::move(right), op));
45  }
46 }
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
x
#define x
conifer::floorlog2
constexpr int floorlog2(int x)
Definition: conifer.h:25
conifer::pow2
constexpr int pow2(int x)
Definition: conifer.h:31
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110