#include <Alignment/LaserAlignment/interface/LASvector2D.h>
Public Member Functions | |
LASvector2D (size_t nrows=0, size_t ncolums=0, const Element init=0) | |
constructor | |
LASvector2D< Element > | operator * (Element multiplicator) const |
multiplication of a LASvector2D with a scalar | |
LASvector2D< Element > | operator * (const LASvector< Element > &multiplicator) const |
element wise product between LASvector2D<T> and LASvector<T> | |
LASvector2D< Element > | operator/ (Element factor) const |
division of a LASvector2D by a scalar | |
Element | sum () |
return sum of all elements in the matrix | |
LASvector< Element > | sumC () |
return sum of elements in the columns of a matrix | |
LASvector< Element > | sumR () |
return sum of elements in the rows of a matrix | |
void | transpose (const LASvector2D< Element > &source) |
transpose the matrix |
matrix format is based on std::vector<std::vector<T>> LASvector2D[n][m] has n columns, m rows
Definition at line 17 of file LASvector2D.h.
LASvector2D< Element >::LASvector2D | ( | size_t | nrows = 0 , |
|
size_t | ncolums = 0 , |
|||
const Element | init = 0 | |||
) | [inline] |
constructor
Definition at line 21 of file LASvector2D.h.
00021 : std::vector<LASvector<Element> >(nrows, LASvector<Element>(ncolums,init)) {};
LASvector2D< Element > LASvector2D< Element >::operator * | ( | Element | multiplicator | ) | const [inline] |
multiplication of a LASvector2D with a scalar
Definition at line 31 of file LASvector2D.cc.
References i, j, and HLT_VtxMuL3::result.
00032 { 00033 LASvector2D<Element> result = (*this); 00034 for( unsigned int i = 0; i < result.size(); ++i ) 00035 { 00036 for( unsigned int j = 0; j < result[0].size(); ++j ) 00037 { 00038 result[i][j] *= multiplicator; 00039 } 00040 } 00041 return result; 00042 }
LASvector2D< Element > LASvector2D< Element >::operator * | ( | const LASvector< Element > & | multiplicator | ) | const [inline] |
element wise product between LASvector2D<T> and LASvector<T>
Definition at line 14 of file LASvector2D.cc.
References lat::endl(), i, j, HLT_VtxMuL3::result, and size.
00015 { 00016 if ((*this)[0].size() != multiplicator.size()) 00017 throw cms::Exception("SizeMisMatch","Size of matrix and multiplicator (vector) do not match!") << this[0].size() 00018 << " does not match the size of the multiplicator " << multiplicator.size() << std::endl; 00019 LASvector2D<Element> result = (*this); 00020 for( unsigned int i = 0; i < result.size(); ++i ) 00021 { 00022 for( unsigned int j = 0; j < result[0].size(); ++j ) 00023 { 00024 result[i][j] *= multiplicator[j]; 00025 } 00026 } 00027 return result; 00028 }
LASvector2D< Element > LASvector2D< Element >::operator/ | ( | Element | factor | ) | const [inline] |
division of a LASvector2D by a scalar
Definition at line 45 of file LASvector2D.cc.
References Exception, i, j, and HLT_VtxMuL3::result.
00046 { 00047 if (factor == 0) 00048 throw cms::Exception("DivisionByZero","Division by zero is not allowed!!!"); 00049 00050 LASvector2D<Element> result = (*this); 00051 for( unsigned int i = 0; i < result.size(); ++i ) 00052 { 00053 for( unsigned int j = 0; j < result[0].size(); ++j ) 00054 { 00055 result[i][j] /= factor; 00056 } 00057 } 00058 return result; 00059 }
template double LASvector2D< Element >::sum | ( | ) | [inline] |
return sum of all elements in the matrix
Definition at line 91 of file LASvector2D.cc.
References i, j, and HLT_VtxMuL3::result.
Referenced by AlignmentAlgorithmBW::run().
00092 { 00093 Element result = 0; 00094 for( unsigned int i = 0; i < (*this).size(); ++i ) 00095 { 00096 for( unsigned int j = 0; j < (*this)[i].size(); ++j ) 00097 { 00098 result += (*this)[i][j]; 00099 } 00100 } 00101 return result; 00102 }
template LASvector< double > LASvector2D< Element >::sumC | ( | ) | [inline] |
return sum of elements in the columns of a matrix
Definition at line 63 of file LASvector2D.cc.
References i, j, and HLT_VtxMuL3::result.
00064 { 00065 LASvector<Element> result((*this).size()); 00066 for( unsigned int i = 0; i < (*this).size(); ++i ) 00067 { 00068 for( unsigned int j = 0; j < (*this)[i].size(); ++j ) 00069 { 00070 result[i] += (*this)[i][j]; 00071 } 00072 } 00073 return result; 00074 }
template LASvector< double > LASvector2D< Element >::sumR | ( | ) | [inline] |
return sum of elements in the rows of a matrix
Definition at line 77 of file LASvector2D.cc.
References i, j, HLT_VtxMuL3::result, and size.
00078 { 00079 LASvector<Element> result((*this)[0].size()); 00080 for( unsigned int i = 0; i < (*this)[0].size(); ++i ) 00081 { 00082 for( unsigned int j = 0; j < (*this).size(); ++j ) 00083 { 00084 result[i] += (*this)[i][j]; 00085 } 00086 } 00087 return result; 00088 }
void LASvector2D< Element >::transpose | ( | const LASvector2D< Element > & | source | ) | [inline] |
transpose the matrix
Definition at line 105 of file LASvector2D.cc.
Referenced by AlignmentAlgorithmBW::run().
00106 { 00107 for( unsigned int i = 0; i < source.size(); ++i ) 00108 { 00109 for( unsigned int j = 0; j < source[i].size(); ++j ) 00110 { 00111 (*this)[j][i] = source[i][j]; 00112 } 00113 } 00114 }