CMS 3D CMS Logo

TensorIndex.h
Go to the documentation of this file.
1 #ifndef TensorIndex_h
2 #define TensorIndex_h
3 template <int d1, int d2 = 1, int d3 = 1, int d4 = 1>
16 class TensorIndex {
17 public:
18  enum { SIZE = d1 * d2 * d3 * d4 };
19  enum { LEN1 = d1 };
20  enum { LEN2 = d2 };
21  enum { LEN3 = d3 };
22  enum { LEN4 = d4 };
23 
24  static int indexOf(const int i) { return i; }
25  static int indexOf(const int i, const int j) { return j * d1 + i; }
26  static int indexOf(const int i, const int j, const int k) { return (k * d2 + j) * d1 + i; }
27  static int indexOf(const int i, const int j, const int k, const int l) { return ((l * d3 + k) * d2 + j) * d1 + i; }
28 };
29 
30 template <int d1, int d2 = 1, int d3 = 1, int d4 = 1>
32 public:
33  enum { SIZE = d1 * d2 * d3 * d4 };
34  enum { LEN1 = d1 };
35  enum { LEN2 = d2 };
36  enum { LEN3 = d3 };
37  enum { LEN4 = d4 };
38 
39  static int indexOf(const int i) { return i - 1; }
40  static int indexOf(const int i, const int j) { return j * d1 + i - 1 - d1; }
41  static int indexOf(const int i, const int j, const int k) { return (k * d2 + j) * d1 + i - 1 - d1 - d1 * d2; }
42  static int indexOf(const int i, const int j, const int k, const int l) {
43  return ((l * d3 + k) * d2 + j) * d1 + i - 1 - d1 - d1 * d2 - d1 * d2 * d3;
44  }
45 };
46 #endif
mps_fire.i
i
Definition: mps_fire.py:428
TensorIndex_base1::indexOf
static int indexOf(const int i, const int j, const int k, const int l)
Definition: TensorIndex.h:42
TensorIndex_base1::indexOf
static int indexOf(const int i, const int j)
Definition: TensorIndex.h:40
TensorIndex::indexOf
static int indexOf(const int i, const int j, const int k, const int l)
Definition: TensorIndex.h:27
TensorIndex_base1::indexOf
static int indexOf(const int i, const int j, const int k)
Definition: TensorIndex.h:41
TensorIndex::LEN2
Definition: TensorIndex.h:20
TensorIndex_base1::LEN3
Definition: TensorIndex.h:36
TensorIndex_base1
Definition: TensorIndex.h:31
TensorIndex::LEN4
Definition: TensorIndex.h:22
TensorIndex_base1::indexOf
static int indexOf(const int i)
Definition: TensorIndex.h:39
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TensorIndex::LEN1
Definition: TensorIndex.h:19
TensorIndex
Definition: TensorIndex.h:16
TensorIndex_base1::SIZE
Definition: TensorIndex.h:33
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
TensorIndex::indexOf
static int indexOf(const int i)
Definition: TensorIndex.h:24
TensorIndex::indexOf
static int indexOf(const int i, const int j, const int k)
Definition: TensorIndex.h:26
TensorIndex::SIZE
Definition: TensorIndex.h:18
TensorIndex_base1::LEN4
Definition: TensorIndex.h:37
TensorIndex_base1::LEN1
Definition: TensorIndex.h:34
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TensorIndex::indexOf
static int indexOf(const int i, const int j)
Definition: TensorIndex.h:25
d1
static constexpr float d1
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
TensorIndex_base1::LEN2
Definition: TensorIndex.h:35
TensorIndex::LEN3
Definition: TensorIndex.h:21