CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes
Matriplex::MatriplexSym< T, D, N > Class Template Reference

#include <MatriplexSym.h>

Public Types

typedef T value_type
 

Public Member Functions

T fArray [kTotSize__attribute__ ((aligned(64)))
 
void add (const MatriplexSym &v)
 
void addNoiseIntoUpperLeft3x3 (T noise)
 
TAt (idx_t n, idx_t i, idx_t j)
 
const TconstAt (idx_t n, idx_t i, idx_t j) const
 
void copy (idx_t n, idx_t in)
 
void copyIn (idx_t n, const T *arr)
 
void copyIn (idx_t n, const MatriplexSym &m, idx_t in)
 
void copyOut (idx_t n, T *arr) const
 
void copySlot (idx_t n, const MatriplexSym &m)
 
void invertUpperLeft3x3 ()
 
 MatriplexSym ()
 
 MatriplexSym (T v)
 
idx_t off (idx_t i) const
 
const idx_toffsets () const
 
Toperator() (idx_t n, idx_t i, idx_t j)
 
const Toperator() (idx_t n, idx_t i, idx_t j) const
 
MatriplexSymoperator= (const MatriplexSym &m)
 
T operator[] (idx_t xx) const
 
Toperator[] (idx_t xx)
 
idx_t plexSize () const
 
void scale (T scale)
 
void setDiagonal3x3 (idx_t n, T d)
 
void setVal (T v)
 
void slurpIn (const T *arr, int vi[N], const int N_proc=N)
 
MatriplexSymsubtract (const MatriplexSym &a, const MatriplexSym &b)
 

Static Public Attributes

static constexpr int kCols = D
 no. of matrix columns More...
 
static constexpr int kRows = D
 no. of matrix rows More...
 
static constexpr int kSize = (D + 1) * D / 2
 no of elements: lower triangle More...
 
static constexpr int kTotSize = N * kSize
 size of the whole matriplex More...
 

Detailed Description

template<typename T, idx_t D, idx_t N>
class Matriplex::MatriplexSym< T, D, N >

Definition at line 25 of file MatriplexSym.h.

Member Typedef Documentation

◆ value_type

template<typename T, idx_t D, idx_t N>
typedef T Matriplex::MatriplexSym< T, D, N >::value_type

Definition at line 27 of file MatriplexSym.h.

Constructor & Destructor Documentation

◆ MatriplexSym() [1/2]

template<typename T, idx_t D, idx_t N>
Matriplex::MatriplexSym< T, D, N >::MatriplexSym ( )
inline

Definition at line 40 of file MatriplexSym.h.

40 {}

◆ MatriplexSym() [2/2]

template<typename T, idx_t D, idx_t N>
Matriplex::MatriplexSym< T, D, N >::MatriplexSym ( T  v)
inline

Definition at line 41 of file MatriplexSym.h.

Member Function Documentation

◆ __attribute__()

template<typename T, idx_t D, idx_t N>
T fArray [kTotSize] Matriplex::MatriplexSym< T, D, N >::__attribute__ ( (aligned(64))  )

◆ add()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::add ( const MatriplexSym< T, D, N > &  v)
inline

Definition at line 51 of file MatriplexSym.h.

Referenced by counter.Counter::register().

51  {
52  for (idx_t i = 0; i < kTotSize; ++i) {
53  fArray[i] += v.fArray[i];
54  }
55  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36

◆ addNoiseIntoUpperLeft3x3()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::addNoiseIntoUpperLeft3x3 ( T  noise)
inline

Definition at line 227 of file MatriplexSym.h.

227  {
228  T* p = fArray;
229  ASSUME_ALIGNED(p, 64);
230 
231 #pragma omp simd
232  for (idx_t n = 0; n < N; ++n) {
233  p[0 * N + n] += noise;
234  p[2 * N + n] += noise;
235  p[5 * N + n] += noise;
236  }
237  }
#define N
Definition: blowfish.cc:9
long double T
#define ASSUME_ALIGNED(a, b)

◆ At()

template<typename T, idx_t D, idx_t N>
T& Matriplex::MatriplexSym< T, D, N >::At ( idx_t  n,
idx_t  i,
idx_t  j 
)
inline

◆ constAt()

template<typename T, idx_t D, idx_t N>
const T& Matriplex::MatriplexSym< T, D, N >::constAt ( idx_t  n,
idx_t  i,
idx_t  j 
) const
inline

◆ copy()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::copy ( idx_t  n,
idx_t  in 
)
inline

Definition at line 99 of file MatriplexSym.h.

99  {
100  for (idx_t i = n; i < kTotSize; i += N, in += N) {
101  fArray[i] = fArray[in];
102  }
103  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
#define N
Definition: blowfish.cc:9

◆ copyIn() [1/2]

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::copyIn ( idx_t  n,
const T arr 
)
inline

◆ copyIn() [2/2]

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::copyIn ( idx_t  n,
const MatriplexSym< T, D, N > &  m,
idx_t  in 
)
inline

Definition at line 93 of file MatriplexSym.h.

93  {
94  for (idx_t i = n; i < kTotSize; i += N, in += N) {
95  fArray[i] = m[in];
96  }
97  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
#define N
Definition: blowfish.cc:9

◆ copyOut()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::copyOut ( idx_t  n,
T arr 
) const
inline

Definition at line 195 of file MatriplexSym.h.

Referenced by mkfit::MkFinder::bkFitOutputTracks(), mkfit::MkFinder::copy_out(), mkfit::MkFinder::copyOutParErr(), mkfit::MkFitter::outputFittedTracksAndHitIdx(), and mkfit::MkFitter::outputTracks().

195  {
196  for (idx_t i = n; i < kTotSize; i += N) {
197  *(arr++) = fArray[i];
198  }
199  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
#define N
Definition: blowfish.cc:9

◆ copySlot()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::copySlot ( idx_t  n,
const MatriplexSym< T, D, N > &  m 
)
inline

Definition at line 81 of file MatriplexSym.h.

Referenced by mkfit::propagateHelixToRMPlex(), and mkfit::propagateHelixToZMPlex().

81  {
82  for (idx_t i = n; i < kTotSize; i += N) {
83  fArray[i] = m.fArray[i];
84  }
85  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
#define N
Definition: blowfish.cc:9

◆ invertUpperLeft3x3()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::invertUpperLeft3x3 ( )
inline

Definition at line 239 of file MatriplexSym.h.

239  {
240  typedef T TT;
241 
242  T* a = fArray;
243  ASSUME_ALIGNED(a, 64);
244 
245 #pragma omp simd
246  for (idx_t n = 0; n < N; ++n) {
247  const TT c00 = a[2 * N + n] * a[5 * N + n] - a[4 * N + n] * a[4 * N + n];
248  const TT c01 = a[4 * N + n] * a[3 * N + n] - a[1 * N + n] * a[5 * N + n];
249  const TT c02 = a[1 * N + n] * a[4 * N + n] - a[2 * N + n] * a[3 * N + n];
250  const TT c11 = a[5 * N + n] * a[0 * N + n] - a[3 * N + n] * a[3 * N + n];
251  const TT c12 = a[3 * N + n] * a[1 * N + n] - a[4 * N + n] * a[0 * N + n];
252  const TT c22 = a[0 * N + n] * a[2 * N + n] - a[1 * N + n] * a[1 * N + n];
253 
254  // Force determinant calculation in double precision.
255  const double det = (double)a[0 * N + n] * c00 + (double)a[1 * N + n] * c01 + (double)a[3 * N + n] * c02;
256  const TT s = TT(1) / det;
257 
258  a[0 * N + n] = s * c00;
259  a[1 * N + n] = s * c01;
260  a[2 * N + n] = s * c11;
261  a[3 * N + n] = s * c02;
262  a[4 * N + n] = s * c12;
263  a[5 * N + n] = s * c22;
264  }
265  }
#define N
Definition: blowfish.cc:9
double a
Definition: hdecay.h:121
long double T
#define ASSUME_ALIGNED(a, b)

◆ off()

template<typename T, idx_t D, idx_t N>
idx_t Matriplex::MatriplexSym< T, D, N >::off ( idx_t  i) const
inline

Definition at line 67 of file MatriplexSym.h.

Referenced by Matriplex::MatriplexSym< float, LL, NN >::At(), and Matriplex::MatriplexSym< float, LL, NN >::constAt().

67 { return gSymOffsets[D][i]; }
const idx_t gSymOffsets[7][36]
Definition: MatriplexSym.h:13
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141

◆ offsets()

template<typename T, idx_t D, idx_t N>
const idx_t* Matriplex::MatriplexSym< T, D, N >::offsets ( ) const
inline

Definition at line 66 of file MatriplexSym.h.

66 { return gSymOffsets[D]; }
const idx_t gSymOffsets[7][36]
Definition: MatriplexSym.h:13
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141

◆ operator()() [1/2]

template<typename T, idx_t D, idx_t N>
T& Matriplex::MatriplexSym< T, D, N >::operator() ( idx_t  n,
idx_t  i,
idx_t  j 
)
inline

Definition at line 73 of file MatriplexSym.h.

73 { return At(n, i, j); }
T & At(idx_t n, idx_t i, idx_t j)
Definition: MatriplexSym.h:71

◆ operator()() [2/2]

template<typename T, idx_t D, idx_t N>
const T& Matriplex::MatriplexSym< T, D, N >::operator() ( idx_t  n,
idx_t  i,
idx_t  j 
) const
inline

Definition at line 74 of file MatriplexSym.h.

74 { return constAt(n, i, j); }
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: MatriplexSym.h:69

◆ operator=()

template<typename T, idx_t D, idx_t N>
MatriplexSym& Matriplex::MatriplexSym< T, D, N >::operator= ( const MatriplexSym< T, D, N > &  m)
inline

Definition at line 76 of file MatriplexSym.h.

76  {
77  memcpy(fArray, m.fArray, sizeof(T) * kTotSize);
78  return *this;
79  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
long double T

◆ operator[]() [1/2]

template<typename T, idx_t D, idx_t N>
T Matriplex::MatriplexSym< T, D, N >::operator[] ( idx_t  xx) const
inline

Definition at line 63 of file MatriplexSym.h.

63 { return fArray[xx]; }

◆ operator[]() [2/2]

template<typename T, idx_t D, idx_t N>
T& Matriplex::MatriplexSym< T, D, N >::operator[] ( idx_t  xx)
inline

Definition at line 64 of file MatriplexSym.h.

64 { return fArray[xx]; }

◆ plexSize()

template<typename T, idx_t D, idx_t N>
idx_t Matriplex::MatriplexSym< T, D, N >::plexSize ( ) const
inline

Definition at line 43 of file MatriplexSym.h.

43 { return N; }
#define N
Definition: blowfish.cc:9

◆ scale()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::scale ( T  scale)
inline

Definition at line 57 of file MatriplexSym.h.

Referenced by mkfit::MkFinder::bkFitInputTracks(), and Matriplex::MatriplexSym< float, LL, NN >::scale().

57  {
58  for (idx_t i = 0; i < kTotSize; ++i) {
59  fArray[i] *= scale;
60  }
61  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36

◆ setDiagonal3x3()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::setDiagonal3x3 ( idx_t  n,
T  d 
)
inline

Definition at line 201 of file MatriplexSym.h.

Referenced by mkfit::MkFinder::addBestHit().

201  {
202  T* p = fArray + n;
203 
204  p[0 * N] = d;
205  p[1 * N] = 0;
206  p[2 * N] = d;
207  p[3 * N] = 0;
208  p[4 * N] = 0;
209  p[5 * N] = d;
210  }
d
Definition: ztail.py:151
#define N
Definition: blowfish.cc:9
long double T

◆ setVal()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::setVal ( T  v)
inline

Definition at line 45 of file MatriplexSym.h.

Referenced by Matriplex::MatriplexSym< float, LL, NN >::MatriplexSym().

45  {
46  for (idx_t i = 0; i < kTotSize; ++i) {
47  fArray[i] = v;
48  }
49  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36

◆ slurpIn()

template<typename T, idx_t D, idx_t N>
void Matriplex::MatriplexSym< T, D, N >::slurpIn ( const T arr,
int  vi[N],
const int  N_proc = N 
)
inline

Definition at line 176 of file MatriplexSym.h.

176  {
177  // Separate N_proc == N case (gains about 7% in fit test).
178  if (N_proc == N) {
179  for (int i = 0; i < kSize; ++i) {
180  for (int j = 0; j < N; ++j) {
181  fArray[i * N + j] = *(arr + i + vi[j]);
182  }
183  }
184  } else {
185  for (int i = 0; i < kSize; ++i) {
186  for (int j = 0; j < N_proc; ++j) {
187  fArray[i * N + j] = *(arr + i + vi[j]);
188  }
189  }
190  }
191  }
#define N
Definition: blowfish.cc:9
static constexpr int kSize
no of elements: lower triangle
Definition: MatriplexSym.h:34

◆ subtract()

template<typename T, idx_t D, idx_t N>
MatriplexSym& Matriplex::MatriplexSym< T, D, N >::subtract ( const MatriplexSym< T, D, N > &  a,
const MatriplexSym< T, D, N > &  b 
)
inline

Definition at line 212 of file MatriplexSym.h.

Referenced by mkfit::kalmanOperation(), and mkfit::kalmanOperationEndcap().

212  {
213  // Does *this = a - b;
214 
215 #pragma omp simd
216  for (idx_t i = 0; i < kTotSize; ++i) {
217  fArray[i] = a.fArray[i] - b.fArray[i];
218  }
219 
220  return *this;
221  }
static constexpr int kTotSize
size of the whole matriplex
Definition: MatriplexSym.h:36
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

Member Data Documentation

◆ kCols

template<typename T, idx_t D, idx_t N>
constexpr int Matriplex::MatriplexSym< T, D, N >::kCols = D
static

no. of matrix columns

Definition at line 32 of file MatriplexSym.h.

◆ kRows

template<typename T, idx_t D, idx_t N>
constexpr int Matriplex::MatriplexSym< T, D, N >::kRows = D
static

no. of matrix rows

Definition at line 30 of file MatriplexSym.h.

◆ kSize

template<typename T, idx_t D, idx_t N>
constexpr int Matriplex::MatriplexSym< T, D, N >::kSize = (D + 1) * D / 2
static

no of elements: lower triangle

Definition at line 34 of file MatriplexSym.h.

Referenced by Matriplex::MatriplexSym< float, LL, NN >::slurpIn().

◆ kTotSize

template<typename T, idx_t D, idx_t N>
constexpr int Matriplex::MatriplexSym< T, D, N >::kTotSize = N * kSize
static