CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1MuGMTMatrix< T > Class Template Reference

#include <L1MuGMTMatrix.h>

Public Member Functions

int colAny (int c) const
 is any element in column c > 0 ? return index or -1 More...
 
void init (T v=0)
 initialize matrix More...
 
bool isMax (int r, int c) const
 is the element (r,c) the max. entry in its row and column? More...
 
bool isMin (int r, int c) const
 is the element (r,c) the min. entry in its row and column? More...
 
 L1MuGMTMatrix (int r, int c)
 constructor More...
 
 L1MuGMTMatrix (const L1MuGMTMatrix< T > &)
 copy constructor More...
 
Toperator() (int r, int c)
 
const Toperator() (int r, int c) const
 
L1MuGMTMatrixoperator*= (const T &s)
 scalar multiplication More...
 
L1MuGMTMatrixoperator+= (const L1MuGMTMatrix &m)
 matrix addition More...
 
L1MuGMTMatrixoperator+= (const T &s)
 scalar addition More...
 
L1MuGMTMatrixoperator= (const L1MuGMTMatrix &m)
 assignment operator More...
 
void print () const
 print matrix More...
 
int rowAny (int r) const
 is any element in row r > 0 ? return index or -1 More...
 
void set (int r, int c, T v)
 set matrix element More...
 
virtual ~L1MuGMTMatrix ()
 destructor More...
 

Private Attributes

int c_size
 
T ** p
 
int r_size
 

Detailed Description

template<class T>
class L1MuGMTMatrix< T >

Matrix.

general matrix

Definition at line 49 of file L1MuGMTMatrix.h.

Constructor & Destructor Documentation

template<class T >
L1MuGMTMatrix< T >::L1MuGMTMatrix ( int  r,
int  c 
)

constructor

Definition at line 111 of file L1MuGMTMatrix.h.

References trackerHits::c, i, L1MuGMTMatrix< T >::p, and alignCSCRings::r.

111  : r_size(r), c_size(c) {
112 
113  p = new T*[r];
114 
115  assert(p != 0);
116 
117  for (int i = 0; i < r; i++) {
118  p[i] = new T[c];
119  assert(p[i] != 0);
120  }
121 
122 }
int i
Definition: DBlmapReader.cc:9
long double T
template<class T>
L1MuGMTMatrix< T >::L1MuGMTMatrix ( const L1MuGMTMatrix< T > &  mat)

copy constructor

Definition at line 128 of file L1MuGMTMatrix.h.

References L1MuGMTMatrix< T >::c_size, i, j, L1MuGMTMatrix< T >::p, and L1MuGMTMatrix< T >::r_size.

128  : r_size(mat.r_size), c_size(mat.c_size) {
129 
130  p = new T*[r_size];
131 
132  assert(p != 0);
133 
134  for (int i = 0; i < r_size; i++) {
135  p[i] = new T[c_size];
136  assert(p[i] != 0);
137  for (int j = 0; j < c_size; j++) p[i][j] = mat.p[i][j];
138  }
139 
140 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
long double T
template<class T >
L1MuGMTMatrix< T >::~L1MuGMTMatrix ( )
virtual

destructor

Definition at line 147 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

147  {
148 
149  for (int i = 0; i < r_size; i++) {
150  delete [] p[i];
151  }
152 
153  delete [] p;
154 
155 }
int i
Definition: DBlmapReader.cc:9

Member Function Documentation

template<class T >
int L1MuGMTMatrix< T >::colAny ( int  c) const

is any element in column c > 0 ? return index or -1

Definition at line 328 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by L1MuGMTCancelOutUnit::decide(), and L1MuGMTMerger::merge().

328  {
329 
330  int stat = -1;
331  for (int i = 0; i < r_size; i++) {
332  if ( this->p[i][c] > 0 ) stat = i;
333  }
334 
335  return stat;
336 
337 }
int i
Definition: DBlmapReader.cc:9
template<class T>
void L1MuGMTMatrix< T >::init ( T  v = 0)

initialize matrix

Definition at line 188 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTInputEvent::L1MuGMTInputEvent(), L1MuGMTPSB::L1MuGMTPSB(), L1MuGMTMatcher::match(), L1MuGMTInputEvent::reset(), L1MuGMTMatcher::reset(), and L1MuGMTPSB::reset().

188  {
189 
190  for (int r = 0; r < r_size; r++) {
191  for (int c = 0; c < c_size; c++) p[r][c] = v;
192  }
193 
194 }
template<class T >
bool L1MuGMTMatrix< T >::isMax ( int  r,
int  c 
) const

is the element (r,c) the max. entry in its row and column?

Definition at line 282 of file L1MuGMTMatrix.h.

References trackerHits::c, i, j, max(), AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTMatcher::match().

282  {
283 
284  bool max = true;
285 
286  for (int i = 0; i < c; i++) {
287  max = max && ( this->p[r][c] > this->p[r][i]);
288  }
289  for (int i = c+1; i < c_size; i++) {
290  max = max && ( this->p[r][c] >= this->p[r][i]);
291  }
292 
293  for (int j = 0; j < r; j++) {
294  max = max && ( this->p[r][c] > this->p[j][c]);
295  }
296  for (int j = r+1; j < r_size; j++) {
297  max = max && ( this->p[r][c] >= this->p[j][c]);
298  }
299 
300  return max;
301 
302 }
int i
Definition: DBlmapReader.cc:9
const T & max(const T &a, const T &b)
int j
Definition: DBlmapReader.cc:9
template<class T >
bool L1MuGMTMatrix< T >::isMin ( int  r,
int  c 
) const

is the element (r,c) the min. entry in its row and column?

Definition at line 309 of file L1MuGMTMatrix.h.

References trackerHits::c, i, j, min, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

309  {
310 
311  bool min = true;
312  for (int i = 0; i < c_size; i++) {
313  min = min && ( this->p[r][c] <= this->p[r][i]);
314  }
315  for (int j = 0; j < r_size; j++) {
316  min = min && ( this->p[r][c] <= this->p[j][c]);
317  }
318 
319  return min;
320 
321 }
int i
Definition: DBlmapReader.cc:9
#define min(a, b)
Definition: mlp_lapack.h:161
int j
Definition: DBlmapReader.cc:9
template<class T >
T & L1MuGMTMatrix< T >::operator() ( int  r,
int  c 
)

Definition at line 162 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

162  {
163 
164  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
165 
166  return p[r][c];
167 
168 }
template<class T >
const T & L1MuGMTMatrix< T >::operator() ( int  r,
int  c 
) const

Definition at line 175 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

175  {
176 
177  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
178 
179  return p[r][c];
180 
181 }
template<class T>
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator*= ( const T s)

scalar multiplication

Definition at line 267 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

267  {
268 
269  for (int r = 0; r < r_size; r++) {
270  for (int c = 0; c < c_size; c++) p[r][c] *= s;
271  }
272 
273  return *this;
274 
275 }
template<class T >
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= ( const L1MuGMTMatrix< T > &  m)

matrix addition

Definition at line 233 of file L1MuGMTMatrix.h.

References trackerHits::c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and L1MuGMTMatrix< T >::r_size.

233  {
234 
235  assert(m.c_size == c_size && m.r_size == r_size);
236 
237  for (int r = 0; r < r_size; r++) {
238  for (int c = 0; c < c_size; c++) {
239  p[r][c] += m.p[r][c];
240  }
241  }
242 
243  return *this;
244 
245 }
template<class T>
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= ( const T s)

scalar addition

Definition at line 252 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

252  {
253 
254  for (int r = 0; r < r_size; r++) {
255  for (int c = 0; c < c_size; c++) p[r][c] += s;
256  }
257 
258  return *this;
259 
260 }
template<class T >
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator= ( const L1MuGMTMatrix< T > &  m)

assignment operator

Definition at line 214 of file L1MuGMTMatrix.h.

References trackerHits::c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and L1MuGMTMatrix< T >::r_size.

214  {
215 
216  if ( this != &m ) {
217  assert(m.c_size == c_size && m.r_size == r_size);
218 
219  for (int r = 0; r < r_size; r++) {
220  for (int c = 0; c < c_size; c++) p[r][c] = m.p[r][c];
221  }
222  }
223 
224  return (*this);
225 
226 }
template<class T >
void L1MuGMTMatrix< T >::print ( void  ) const

print matrix

Definition at line 360 of file L1MuGMTMatrix.h.

References trackerHits::c, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, and alignCSCRings::r.

Referenced by L1MuGMTMatcher::print().

360  {
361 
362  for (int r = 0; r < r_size; r++) {
363  std::stringstream output;
364  for (int c = 0; c < c_size; c++) output << p[r][c] << "\t";
365  edm::LogVerbatim("GMTMatrix_print") << output.str();
366  }
367  edm::LogVerbatim("GMTMatrix_print");
368 
369 }
template<class T >
int L1MuGMTMatrix< T >::rowAny ( int  r) const

is any element in row r > 0 ? return index or -1

Definition at line 344 of file L1MuGMTMatrix.h.

References i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by L1MuGMTCancelOutUnit::decide(), and L1MuGMTMerger::merge().

344  {
345 
346  int stat = -1;
347  for (int i = 0; i < c_size; i++) {
348  if ( this->p[r][i] > 0 ) stat = i;
349  }
350 
351  return stat;
352 
353 }
int i
Definition: DBlmapReader.cc:9
template<class T>
void L1MuGMTMatrix< T >::set ( int  r,
int  c,
T  v 
)

set matrix element

Definition at line 201 of file L1MuGMTMatrix.h.

References trackerHits::c, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and findQualityFiles::v.

Referenced by L1MuGMTPSB::getCalo(), and betterConfigParser.BetterConfigParser::getGeneral().

201  {
202 
203  assert( r >= 0 && r < r_size && c >= 0 && c < c_size );
204 
205  p[r][c] = v;
206 
207 }

Member Data Documentation

template<class T>
int L1MuGMTMatrix< T >::c_size
private
template<class T>
T** L1MuGMTMatrix< T >::p
private
template<class T>
int L1MuGMTMatrix< T >::r_size
private