CMS 3D CMS Logo

LASvector< Element > Class Template Reference

helper class contains vector algebra used by Bruno's alignment algorithm. More...

#include <Alignment/LaserAlignment/interface/LASvector.h>

List of all members.

Public Member Functions

void cosine (const LASvector< Element > &source)
 define element wise cos function for a LASvector, i.e. returned vector contains $cos(x_i)$ corresponding to $x_i$ of source vector
 LASvector (size_t size=0, const Element init=0)
 constructor
LASvector< Element > operator * (Element mulitplicator) const
 define multiplication of a LASvector with a scalar
LASvector< Element > operator * (const LASvector< Element > &source) const
 define element wise multiplication of two LASvectors
LASvector< Element > operator+ (Element source) const
 define sum between LASvector and a scalar
LASvector< Element > operator+ (const LASvector< Element > &source) const
 define element wise sum of two LASvectors
LASvector< Element > operator- (Element source) const
 define difference between LASvector and a scalar
LASvector< Element > operator- (const LASvector< Element > &source) const
 define element wise subtraction of two LASvectors
void operator-= (Element subtractor)
 define operator -= of a LASvector;
LASvector< Element > operator/ (Element factor) const
 define division of a LASvector by a scalar
void sine (const LASvector< Element > &source)
 define element wise sin function for a LASvector, i.e. returned vector contains $sin(x_i)$ corresponding to $x_i$ of source vector
Element sum ()
 return the sum of all entries in the vector


Detailed Description

template<class Element>
class LASvector< Element >

helper class contains vector algebra used by Bruno's alignment algorithm.

vector format is based on std::vector<double>

Date
2007/05/08 08:03:23
Revision
1.1
Author:
Maarten Thomas

Definition at line 15 of file LASvector.h.


Constructor & Destructor Documentation

template<class Element>
LASvector< Element >::LASvector ( size_t  size = 0,
const Element  init = 0 
) [inline]

constructor


Member Function Documentation

template<class Element>
void LASvector< Element >::cosine ( const LASvector< Element > &  source  )  [inline]

define element wise cos function for a LASvector, i.e. returned vector contains $cos(x_i)$ corresponding to $x_i$ of source vector

Definition at line 129 of file LASvector.cc.

References funct::cos(), and i.

Referenced by AlignmentAlgorithmBW::run().

00130 {
00131   for( unsigned int i = 0; i < source.size(); ++i )
00132   {
00133     (*this)[i] = cos(source[i]);
00134   }
00135 }

template<class Element>
LASvector< Element > LASvector< Element >::operator * ( Element  mulitplicator  )  const [inline]

define multiplication of a LASvector with a scalar

Definition at line 85 of file LASvector.cc.

References i, and HLT_VtxMuL3::result.

00086 {
00087   LASvector<Element> result(*this);
00088   for( unsigned int i = 0; i < result.size(); ++i )
00089   {
00090     result[i] *= multiplicator;
00091   }
00092   return result;
00093 }

template<class Element>
LASvector< Element > LASvector< Element >::operator * ( const LASvector< Element > &  source  )  const [inline]

define element wise multiplication of two LASvectors

Definition at line 69 of file LASvector.cc.

References lat::endl(), i, HLT_VtxMuL3::result, and size.

00070 {
00071   // check if size matches, else throw exception
00072   if (this->size() != source.size())
00073     throw cms::Exception("SizeMisMatch","Size of vectors do not match!") << this->size() 
00074       << " does not match the size of the multiplicator " << source.size() << std::endl;
00075         
00076   LASvector<Element> result(*this);
00077   for( unsigned int i = 0; i < result.size(); ++i )
00078   {
00079     result[i]*=source[i];
00080   }
00081   return result;
00082 }

template<class Element>
LASvector< Element > LASvector< Element >::operator+ ( Element  source  )  const [inline]

define sum between LASvector and a scalar

Definition at line 31 of file LASvector.cc.

References i, and HLT_VtxMuL3::result.

00032 {
00033   LASvector<Element> result(*this);
00034   for( unsigned int i = 0; i < result.size(); ++i )
00035   {
00036     result[i] += source;
00037   }  
00038   return result;
00039 }

template<class Element>
LASvector< Element > LASvector< Element >::operator+ ( const LASvector< Element > &  source  )  const [inline]

define element wise sum of two LASvectors

Definition at line 15 of file LASvector.cc.

References lat::endl(), i, HLT_VtxMuL3::result, and size.

00016 {
00017   // check if size matches, else throw exception
00018   if (this->size() != source.size())
00019     throw cms::Exception("SizeMisMatch","Size of vectors do not match!") << this->size() 
00020       << " does not match the size of the multiplicator " << source.size() << std::endl;
00021 
00022   LASvector<Element> result(*this);
00023   for( unsigned int i = 0; i < result.size(); ++i )
00024   {
00025     result[i] += source[i];
00026   }  
00027   return result;
00028 }

template<class Element>
LASvector< Element > LASvector< Element >::operator- ( Element  source  )  const [inline]

define difference between LASvector and a scalar

Definition at line 58 of file LASvector.cc.

References i, and HLT_VtxMuL3::result.

00059 {
00060   LASvector<Element> result(*this);
00061   for( unsigned int i = 0; i < result.size(); ++i )
00062   {
00063     result[i] -= source;
00064   }  
00065   return result;
00066 }

template<class Element>
LASvector< Element > LASvector< Element >::operator- ( const LASvector< Element > &  source  )  const [inline]

define element wise subtraction of two LASvectors

Definition at line 42 of file LASvector.cc.

References lat::endl(), i, HLT_VtxMuL3::result, and size.

00043 {
00044   // check if size matches, else throw exception
00045   if (this->size() != source.size())
00046     throw cms::Exception("SizeMisMatch","Size of vectors do not match!") << this->size() 
00047       << " does not match the size of the multiplicator " << source.size() << std::endl;
00048 
00049   LASvector<Element> result(*this);
00050   for( unsigned int i = 0; i < result.size(); ++i )
00051   {
00052     result[i] -= source[i];
00053   }  
00054   return result;
00055 }

template<class Element>
void LASvector< Element >::operator-= ( Element  subtractor  )  [inline]

define operator -= of a LASvector;

Definition at line 110 of file LASvector.cc.

References i.

00111 {
00112   for( unsigned int i = 0; i < (*this).size(); ++i )
00113   {
00114     (*this)[i] -= subtractor;
00115   }
00116 }

template<class Element>
LASvector< Element > LASvector< Element >::operator/ ( Element  factor  )  const [inline]

define division of a LASvector by a scalar

Definition at line 96 of file LASvector.cc.

References Exception, i, and HLT_VtxMuL3::result.

00097 {
00098   if (factor == 0)
00099     throw cms::Exception("DivisionByZero","Division by zero is not allowed!!!");
00100     
00101   LASvector<Element> result = (*this);
00102   for( unsigned int i = 0; i < result.size(); ++i )
00103   {
00104       result[i] /= factor;
00105   }
00106   return result;
00107 }

template<class Element>
void LASvector< Element >::sine ( const LASvector< Element > &  source  )  [inline]

define element wise sin function for a LASvector, i.e. returned vector contains $sin(x_i)$ corresponding to $x_i$ of source vector

Definition at line 119 of file LASvector.cc.

References i, HLT_VtxMuL3::result, and funct::sin().

Referenced by AlignmentAlgorithmBW::run().

00120 {
00121   LASvector<Element> result;
00122   for( unsigned int i = 0; i < source.size(); ++i )
00123   {
00124     (*this)[i] = sin(source[i]);
00125   }
00126 }

template<class Element>
template double LASvector< Element >::sum (  )  [inline]

return the sum of all entries in the vector

Definition at line 138 of file LASvector.cc.

References i, and HLT_VtxMuL3::result.

00139 {
00140   Element result = 0;
00141   for( unsigned int i = 0; i < (*this).size(); ++i )
00142   {
00143     result += (*this)[i];
00144   }
00145   return result;
00146 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:27:27 2009 for CMSSW by  doxygen 1.5.4