#include <L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatrix.h>
Public Member Functions | |
int | colAny (int c) const |
is any element in column c > 0 ? return index or -1 | |
void | init (T v=0) |
initialize matrix | |
bool | isMax (int r, int c) const |
is the element (r,c) the max. entry in its row and column? | |
bool | isMin (int r, int c) const |
is the element (r,c) the min. entry in its row and column? | |
L1MuGMTMatrix (const L1MuGMTMatrix< T > &) | |
copy constructor | |
L1MuGMTMatrix (int r, int c) | |
constructor | |
L1MuGMTMatrix & | operator *= (const T &s) |
scalar multiplication | |
const T & | operator() (int r, int c) const |
T & | operator() (int r, int c) |
L1MuGMTMatrix & | operator+= (const T &s) |
scalar addition | |
L1MuGMTMatrix & | operator+= (const L1MuGMTMatrix &m) |
matrix addition | |
L1MuGMTMatrix & | operator= (const L1MuGMTMatrix &m) |
assignment operator | |
void | print () const |
print matrix | |
int | rowAny (int r) const |
is any element in row r > 0 ? return index or -1 | |
void | set (int r, int c, T v) |
set matrix element | |
virtual | ~L1MuGMTMatrix () |
destructor | |
Private Attributes | |
int | c_size |
T ** | p |
int | r_size |
general matrix
Definition at line 49 of file L1MuGMTMatrix.h.
L1MuGMTMatrix< T >::L1MuGMTMatrix | ( | int | r, | |
int | c | |||
) | [inline] |
L1MuGMTMatrix< T >::L1MuGMTMatrix | ( | const L1MuGMTMatrix< T > & | mat | ) | [inline] |
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.
00128 : r_size(mat.r_size), c_size(mat.c_size) { 00129 00130 p = new T*[r_size]; 00131 00132 assert(p != 0); 00133 00134 for (int i = 0; i < r_size; i++) { 00135 p[i] = new T[c_size]; 00136 assert(p[i] != 0); 00137 for (int j = 0; j < c_size; j++) p[i][j] = mat.p[i][j]; 00138 } 00139 00140 }
L1MuGMTMatrix< T >::~L1MuGMTMatrix | ( | ) | [inline, virtual] |
destructor
Definition at line 147 of file L1MuGMTMatrix.h.
References i, L1MuGMTMatrix< T >::p, and L1MuGMTMatrix< T >::r_size.
00147 { 00148 00149 for (int i = 0; i < r_size; i++) { 00150 delete [] p[i]; 00151 } 00152 00153 delete [] p; 00154 00155 }
int L1MuGMTMatrix< T >::colAny | ( | int | c | ) | const [inline] |
is any element in column c > 0 ? return index or -1
Definition at line 328 of file L1MuGMTMatrix.h.
References i, and L1MuGMTMatrix< T >::r_size.
Referenced by L1MuGMTMerger::merge().
00328 { 00329 00330 int stat = -1; 00331 for (int i = 0; i < r_size; i++) { 00332 if ( this->p[i][c] > 0 ) stat = i; 00333 } 00334 00335 return stat; 00336 00337 }
void L1MuGMTMatrix< T >::init | ( | T | v = 0 |
) | [inline] |
initialize matrix
Definition at line 188 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
Referenced by L1MuGMTMatcher::match(), and L1MuGMTMatcher::reset().
00188 { 00189 00190 for (int r = 0; r < r_size; r++) { 00191 for (int c = 0; c < c_size; c++) p[r][c] = v; 00192 } 00193 00194 }
bool L1MuGMTMatrix< T >::isMax | ( | int | r, | |
int | c | |||
) | const [inline] |
is the element (r,c) the max. entry in its row and column?
Definition at line 282 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, i, j, max, L1MuGMTMatrix< T >::p, and L1MuGMTMatrix< T >::r_size.
Referenced by L1MuGMTMatcher::match().
00282 { 00283 00284 bool max = true; 00285 00286 for (int i = 0; i < c; i++) { 00287 max = max && ( this->p[r][c] > this->p[r][i]); 00288 } 00289 for (int i = c+1; i < c_size; i++) { 00290 max = max && ( this->p[r][c] >= this->p[r][i]); 00291 } 00292 00293 for (int j = 0; j < r; j++) { 00294 max = max && ( this->p[r][c] > this->p[j][c]); 00295 } 00296 for (int j = r+1; j < r_size; j++) { 00297 max = max && ( this->p[r][c] >= this->p[j][c]); 00298 } 00299 00300 return max; 00301 00302 }
bool L1MuGMTMatrix< T >::isMin | ( | int | r, | |
int | c | |||
) | const [inline] |
is the element (r,c) the min. entry in its row and column?
Definition at line 309 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, i, j, min, L1MuGMTMatrix< T >::p, and L1MuGMTMatrix< T >::r_size.
00309 { 00310 00311 bool min = true; 00312 for (int i = 0; i < c_size; i++) { 00313 min = min && ( this->p[r][c] <= this->p[r][i]); 00314 } 00315 for (int j = 0; j < r_size; j++) { 00316 min = min && ( this->p[r][c] <= this->p[j][c]); 00317 } 00318 00319 return min; 00320 00321 }
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator *= | ( | const T & | s | ) | [inline] |
scalar multiplication
Definition at line 267 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
00267 { 00268 00269 for (int r = 0; r < r_size; r++) { 00270 for (int c = 0; c < c_size; c++) p[r][c] *= s; 00271 } 00272 00273 return *this; 00274 00275 }
const T & L1MuGMTMatrix< T >::operator() | ( | int | r, | |
int | c | |||
) | const [inline] |
Definition at line 175 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, and L1MuGMTMatrix< T >::p.
00175 { 00176 00177 assert( r >= 0 && r < r_size && c >= 0 && c < c_size ); 00178 00179 return p[r][c]; 00180 00181 }
T & L1MuGMTMatrix< T >::operator() | ( | int | r, | |
int | c | |||
) | [inline] |
Definition at line 162 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, and L1MuGMTMatrix< T >::p.
00162 { 00163 00164 assert( r >= 0 && r < r_size && c >= 0 && c < c_size ); 00165 00166 return p[r][c]; 00167 00168 }
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= | ( | const T & | s | ) | [inline] |
scalar addition
Definition at line 252 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
00252 { 00253 00254 for (int r = 0; r < r_size; r++) { 00255 for (int c = 0; c < c_size; c++) p[r][c] += s; 00256 } 00257 00258 return *this; 00259 00260 }
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator+= | ( | const L1MuGMTMatrix< T > & | m | ) | [inline] |
matrix addition
Definition at line 233 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
00233 { 00234 00235 assert(m.c_size == c_size && m.r_size == r_size); 00236 00237 for (int r = 0; r < r_size; r++) { 00238 for (int c = 0; c < c_size; c++) { 00239 p[r][c] += m.p[r][c]; 00240 } 00241 } 00242 00243 return *this; 00244 00245 }
L1MuGMTMatrix< T > & L1MuGMTMatrix< T >::operator= | ( | const L1MuGMTMatrix< T > & | m | ) | [inline] |
assignment operator
Definition at line 214 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
00214 { 00215 00216 if ( this != &m ) { 00217 assert(m.c_size == c_size && m.r_size == r_size); 00218 00219 for (int r = 0; r < r_size; r++) { 00220 for (int c = 0; c < c_size; c++) p[r][c] = m.p[r][c]; 00221 } 00222 } 00223 00224 return (*this); 00225 00226 }
void L1MuGMTMatrix< T >::print | ( | void | ) | const [inline] |
print matrix
Definition at line 360 of file L1MuGMTMatrix.h.
References c, L1MuGMTMatrix< T >::c_size, output(), L1MuGMTMatrix< T >::p, r, and L1MuGMTMatrix< T >::r_size.
Referenced by L1MuGMTMatcher::print().
00360 { 00361 00362 for (int r = 0; r < r_size; r++) { 00363 std::stringstream output; 00364 for (int c = 0; c < c_size; c++) output << p[r][c] << "\t"; 00365 edm::LogVerbatim("GMTMatrix_print") << output.str(); 00366 } 00367 edm::LogVerbatim("GMTMatrix_print"); 00368 00369 }
int L1MuGMTMatrix< T >::rowAny | ( | int | r | ) | const [inline] |
is any element in row r > 0 ? return index or -1
Definition at line 344 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, and i.
Referenced by L1MuGMTMerger::merge().
00344 { 00345 00346 int stat = -1; 00347 for (int i = 0; i < c_size; i++) { 00348 if ( this->p[r][i] > 0 ) stat = i; 00349 } 00350 00351 return stat; 00352 00353 }
void L1MuGMTMatrix< T >::set | ( | int | r, | |
int | c, | |||
T | v | |||
) | [inline] |
set matrix element
Definition at line 201 of file L1MuGMTMatrix.h.
References L1MuGMTMatrix< T >::c_size, and L1MuGMTMatrix< T >::p.
00201 { 00202 00203 assert( r >= 0 && r < r_size && c >= 0 && c < c_size ); 00204 00205 p[r][c] = v; 00206 00207 }
int L1MuGMTMatrix< T >::c_size [private] |
Definition at line 103 of file L1MuGMTMatrix.h.
Referenced by L1MuGMTMatrix< T >::init(), L1MuGMTMatrix< T >::isMax(), L1MuGMTMatrix< T >::isMin(), L1MuGMTMatrix< T >::L1MuGMTMatrix(), L1MuGMTMatrix< T >::operator *=(), L1MuGMTMatrix< T >::operator()(), L1MuGMTMatrix< T >::operator+=(), L1MuGMTMatrix< T >::operator=(), L1MuGMTMatrix< T >::print(), L1MuGMTMatrix< T >::rowAny(), and L1MuGMTMatrix< T >::set().
T** L1MuGMTMatrix< T >::p [private] |
Definition at line 105 of file L1MuGMTMatrix.h.
Referenced by L1MuGMTMatrix< T >::init(), L1MuGMTMatrix< T >::isMax(), L1MuGMTMatrix< T >::isMin(), L1MuGMTMatrix< T >::L1MuGMTMatrix(), L1MuGMTMatrix< T >::operator *=(), L1MuGMTMatrix< T >::operator()(), L1MuGMTMatrix< T >::operator+=(), L1MuGMTMatrix< T >::operator=(), L1MuGMTMatrix< T >::print(), L1MuGMTMatrix< T >::set(), and L1MuGMTMatrix< T >::~L1MuGMTMatrix().
int L1MuGMTMatrix< T >::r_size [private] |
Definition at line 103 of file L1MuGMTMatrix.h.
Referenced by L1MuGMTMatrix< T >::colAny(), L1MuGMTMatrix< T >::init(), L1MuGMTMatrix< T >::isMax(), L1MuGMTMatrix< T >::isMin(), L1MuGMTMatrix< T >::L1MuGMTMatrix(), L1MuGMTMatrix< T >::operator *=(), L1MuGMTMatrix< T >::operator+=(), L1MuGMTMatrix< T >::operator=(), L1MuGMTMatrix< T >::print(), and L1MuGMTMatrix< T >::~L1MuGMTMatrix().