CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
MatRepSparse< T, D1, D2, S, F > Class Template Reference

#include <MatRepSparse.h>

Public Types

enum  { kRows = D1, kCols = D1, kSize = S }
 
typedef T value_type
 

Public Member Functions

T apply (unsigned int i) const
 
TArray ()
 
const TArray () const
 
 MatRepSparse ()
 
template<typename FI >
 MatRepSparse (FI fi)
 
T const & operator() (unsigned int i, unsigned int j) const
 
Toperator() (unsigned int i, unsigned int j)
 
template<class R >
MatRepSparseoperator+= (const R &)
 
MatRepSparseoperator+= (const MatRepSparse &rhs)
 
template<class R >
MatRepSparseoperator-= (const R &)
 
MatRepSparseoperator-= (const MatRepSparse &rhs)
 
template<class R >
MatRepSparseoperator= (const R &)
 
MatRepSparseoperator= (const MatRepSparse &rhs)
 
template<class R >
bool operator== (const R &rhs) const
 
Toperator[] (unsigned int i)
 
T const & operator[] (unsigned int i) const
 

Static Public Member Functions

static T const & csink ()
 
static Tsink ()
 

Public Attributes

F f
 
T fArray [kSize] ={0}
 

Detailed Description

template<typename T, unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
class MatRepSparse< T, D1, D2, S, F >

a sparse matrix just for storage purposes can be assigned to other matrices

Definition at line 11 of file MatRepSparse.h.

Member Typedef Documentation

template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
typedef T MatRepSparse< T, D1, D2, S, F >::value_type

Definition at line 18 of file MatRepSparse.h.

Member Enumeration Documentation

template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
anonymous enum
Enumerator
kRows 

return no. of matrix rows

kCols 

return no. of matrix columns

kSize 

return no of elements: rows*columns

Definition at line 112 of file MatRepSparse.h.

112  {
114  kRows = D1,
116  kCols = D1,
118  kSize = S
119  };
return no. of matrix rows
Definition: MatRepSparse.h:114
Divides< A, C > D1
Definition: Factorize.h:144
return no of elements: rows*columns
Definition: MatRepSparse.h:118
return no. of matrix columns
Definition: MatRepSparse.h:116
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99

Constructor & Destructor Documentation

template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
MatRepSparse< T, D1, D2, S, F >::MatRepSparse ( )
inline

Definition at line 14 of file MatRepSparse.h.

14 {}
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
template<typename FI >
MatRepSparse< T, D1, D2, S, F >::MatRepSparse ( FI  fi)
inlineexplicit

Definition at line 16 of file MatRepSparse.h.

16 : f(fi) { }

Member Function Documentation

template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T MatRepSparse< T, D1, D2, S, F >::apply ( unsigned int  i) const
inline

Definition at line 51 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::f, MatRepSparse< T, D1, D2, S, F >::fArray, and gen::k.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), jetTools.AddJetCollection::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and metUncertaintyTools.RunMEtUncertainties::__call__().

51  {
52  int k = f(i);
53  return k<0 ? 0 : fArray[k];
54  }
int i
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T* MatRepSparse< T, D1, D2, S, F >::Array ( )
inline
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
const T* MatRepSparse< T, D1, D2, S, F >::Array ( ) const
inline

Definition at line 58 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::fArray.

58 { return fArray; }
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
static T const& MatRepSparse< T, D1, D2, S, F >::csink ( )
inlinestatic

Definition at line 25 of file MatRepSparse.h.

References edmStreamStallGrapher::t.

Referenced by MatRepSparse< T, D1, D2, S, F >::operator()(), and MatRepSparse< T, D1, D2, S, F >::operator[]().

25  {
26  static const T t=0;
27  return t;
28  }
long double T
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T const& MatRepSparse< T, D1, D2, S, F >::operator() ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 31 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::csink(), MatRepSparse< T, D1, D2, S, F >::f, MatRepSparse< T, D1, D2, S, F >::fArray, and gen::k.

31  {
32  int k = f(i*D2+j);
33  return k<0 ? csink() : fArray[k];
34  }
Divides< B, C > D2
Definition: Factorize.h:145
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
static T const & csink()
Definition: MatRepSparse.h:25
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T& MatRepSparse< T, D1, D2, S, F >::operator() ( unsigned int  i,
unsigned int  j 
)
inline

Definition at line 36 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::f, MatRepSparse< T, D1, D2, S, F >::fArray, gen::k, and MatRepSparse< T, D1, D2, S, F >::sink().

36  {
37  int k = f(i*D2+j);
38  return k<0 ? sink() : fArray[k];
39  }
Divides< B, C > D2
Definition: Factorize.h:145
int i
Definition: DBlmapReader.cc:9
static T & sink()
Definition: MatRepSparse.h:20
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
template<class R >
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator+= ( const R &  )
inline

self addition : only sparse to sparse allowed

Definition at line 79 of file MatRepSparse.h.

References dttmaxenums::R, and relativeConstraints::value.

79  {
80  static_assert(std::is_same<R,MatRepSparse<T,D1,D2,S,F>>::value,
81  "Cannot_add_general_to_sparse_matrix_representation");
82  return *this;
83  }
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator+= ( const MatRepSparse< T, D1, D2, S, F > &  rhs)
inline

Definition at line 84 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::Array(), MatRepSparse< T, D1, D2, S, F >::fArray, i, and MatRepSparse< T, D1, D2, S, F >::kSize.

84  {
85  for(unsigned int i=0; i<kSize; ++i) fArray[i] += rhs.Array()[i];
86  return *this;
87  }
int i
Definition: DBlmapReader.cc:9
return no of elements: rows*columns
Definition: MatRepSparse.h:118
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
template<class R >
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator-= ( const R &  )
inline

self subtraction : only sparse to sparse allowed

Definition at line 93 of file MatRepSparse.h.

References dttmaxenums::R, and relativeConstraints::value.

93  {
94  static_assert(std::is_same<R,MatRepSparse<T,D1,D2,S,F>>::value,
95  "Cannot_substract_general_to_sparse_matrix_representation");
96  return *this;
97  }
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator-= ( const MatRepSparse< T, D1, D2, S, F > &  rhs)
inline

Definition at line 99 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::Array(), MatRepSparse< T, D1, D2, S, F >::fArray, i, and MatRepSparse< T, D1, D2, S, F >::kSize.

99  {
100  for(unsigned int i=0; i<kSize; ++i) fArray[i] -= rhs.Array()[i];
101  return *this;
102  }
int i
Definition: DBlmapReader.cc:9
return no of elements: rows*columns
Definition: MatRepSparse.h:118
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
template<class R >
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator= ( const R &  )
inline

assignment : only sparse to sparse allowed

Definition at line 64 of file MatRepSparse.h.

References dttmaxenums::R, and relativeConstraints::value.

64  {
65  static_assert(std::is_same<R,MatRepSparse<T,D1,D2,S,F>>::value,
66  "Cannot_assign_general_to_sparse_matrix_representation");
67  return *this;
68  }
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
MatRepSparse& MatRepSparse< T, D1, D2, S, F >::operator= ( const MatRepSparse< T, D1, D2, S, F > &  rhs)
inline

Definition at line 70 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::Array(), MatRepSparse< T, D1, D2, S, F >::fArray, i, and MatRepSparse< T, D1, D2, S, F >::kSize.

70  {
71  for(unsigned int i=0; i<kSize; ++i) fArray[i] = rhs.Array()[i];
72  return *this;
73  }
int i
Definition: DBlmapReader.cc:9
return no of elements: rows*columns
Definition: MatRepSparse.h:118
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
template<class R >
bool MatRepSparse< T, D1, D2, S, F >::operator== ( const R &  rhs) const
inline

Definition at line 104 of file MatRepSparse.h.

References i, and MatRepSparse< T, D1, D2, S, F >::operator[]().

104  {
105  bool rc = true;
106  for(unsigned int i=0; i<D1*D2; ++i) {
107  rc = rc && (operator[](i) == rhs[i]);
108  }
109  return rc;
110  }
Divides< B, C > D2
Definition: Factorize.h:145
int i
Definition: DBlmapReader.cc:9
Divides< A, C > D1
Definition: Factorize.h:144
T & operator[](unsigned int i)
Definition: MatRepSparse.h:41
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T& MatRepSparse< T, D1, D2, S, F >::operator[] ( unsigned int  i)
inline

Definition at line 41 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::f, MatRepSparse< T, D1, D2, S, F >::fArray, gen::k, and MatRepSparse< T, D1, D2, S, F >::sink().

Referenced by MatRepSparse< T, D1, D2, S, F >::operator==().

41  {
42  int k = f(i);
43  return k<0 ? sink() : fArray[k];
44  }
int i
Definition: DBlmapReader.cc:9
static T & sink()
Definition: MatRepSparse.h:20
int k[5][pyjets_maxn]
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T const& MatRepSparse< T, D1, D2, S, F >::operator[] ( unsigned int  i) const
inline

Definition at line 46 of file MatRepSparse.h.

References MatRepSparse< T, D1, D2, S, F >::csink(), MatRepSparse< T, D1, D2, S, F >::f, MatRepSparse< T, D1, D2, S, F >::fArray, and gen::k.

46  {
47  int k = f(i);
48  return k<0 ? csink() : fArray[k];
49  }
int i
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
static T const & csink()
Definition: MatRepSparse.h:25
T fArray[kSize]
Definition: MatRepSparse.h:123
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
static T& MatRepSparse< T, D1, D2, S, F >::sink ( )
inlinestatic

Definition at line 20 of file MatRepSparse.h.

References edmStreamStallGrapher::t.

Referenced by MatRepSparse< T, D1, D2, S, F >::operator()(), and MatRepSparse< T, D1, D2, S, F >::operator[]().

20  {
21  static T t=0; // this should throw...
22  return t;
23  }
long double T

Member Data Documentation

template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
F MatRepSparse< T, D1, D2, S, F >::f
template<typename T , unsigned int D1, unsigned int D2, unsigned int S, typename F = int(*)(int)>
T MatRepSparse< T, D1, D2, S, F >::fArray[kSize] ={0}