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 | Private Attributes
RKSmallVector< T, N > Class Template Reference

#include <RKSmallVector.h>

Public Types

typedef T Scalar
 

Public Member Functions

int dim () const
 
dot (const RKSmallVector &v) const
 Scalar product, or "dot" product, with a vector of same type. More...
 
template<class U >
RKSmallVectorincrement (const RKSmallVector< U, N > &v, const T &t)
 Increment by another vector multiplied by a scalar. More...
 
const T & operator() (int i) const
 access to values More...
 
T & operator() (int i)
 
RKSmallVectoroperator*= (const T &t)
 Scaling by a scalar value (multiplication) More...
 
template<class U >
RKSmallVectoroperator+= (const RKSmallVector< U, N > &v)
 Operations with vector of same size. More...
 
RKSmallVector operator- () const
 Unary minus, returns a vector with negated components. More...
 
template<class U >
RKSmallVectoroperator-= (const RKSmallVector< U, N > &v)
 
RKSmallVectoroperator/= (const T &t)
 Scaling by a scalar value (division) More...
 
const T & operator[] (int i) const
 
T & operator[] (int i)
 
 RKSmallVector ()
 
 RKSmallVector (const Scalar *d)
 Construct from array. More...
 
template<class Iter >
 RKSmallVector (Iter begin, Iter end)
 
int size () const
 

Private Attributes

Scalar data_ [N]
 

Detailed Description

template<typename T, int N>
class RKSmallVector< T, N >

Definition at line 9 of file RKSmallVector.h.

Member Typedef Documentation

template<typename T, int N>
typedef T RKSmallVector< T, N >::Scalar

Definition at line 11 of file RKSmallVector.h.

Constructor & Destructor Documentation

template<typename T, int N>
RKSmallVector< T, N >::RKSmallVector ( )
inline

Definition at line 13 of file RKSmallVector.h.

13 {}
template<typename T, int N>
RKSmallVector< T, N >::RKSmallVector ( const Scalar d)
inline

Construct from array.

Definition at line 16 of file RKSmallVector.h.

16  {
17  for (int i=0; i<N; ++i) data_[i] = d[i];
18  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
template<class Iter >
RKSmallVector< T, N >::RKSmallVector ( Iter  begin,
Iter  end 
)
inline

construct from pair of iterators; when dereferenced, they should return a type convertible to Scalar. The iterator range shold be exactly N

Definition at line 22 of file RKSmallVector.h.

22  {
23  for (int i=0; i<N; i++) data_[i] = *begin++;
24  }
int i
Definition: DBlmapReader.cc:9
#define begin
Definition: vmac.h:31
Scalar data_[N]
Definition: RKSmallVector.h:84

Member Function Documentation

template<typename T, int N>
int RKSmallVector< T, N >::dim ( ) const
inline

Definition at line 27 of file RKSmallVector.h.

template<typename T, int N>
T RKSmallVector< T, N >::dot ( const RKSmallVector< T, N > &  v) const
inline

Scalar product, or "dot" product, with a vector of same type.

Definition at line 76 of file RKSmallVector.h.

76  {
78  for (int i=0; i<N; ++i) r[i] = data_[i]*data_[i];
79  return r;
80  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
template<class U >
RKSmallVector& RKSmallVector< T, N >::increment ( const RKSmallVector< U, N > &  v,
const T &  t 
)
inline

Increment by another vector multiplied by a scalar.

Definition at line 51 of file RKSmallVector.h.

51  {
52  for (int i=0; i<N; ++i) data_[i] += t*v[i];
53  return *this;
54  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
const T& RKSmallVector< T, N >::operator() ( int  i) const
inline

access to values

Definition at line 30 of file RKSmallVector.h.

30 {return data_[i];}
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
T& RKSmallVector< T, N >::operator() ( int  i)
inline

Definition at line 31 of file RKSmallVector.h.

31 {return data_[i];}
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
RKSmallVector& RKSmallVector< T, N >::operator*= ( const T &  t)
inline

Scaling by a scalar value (multiplication)

Definition at line 65 of file RKSmallVector.h.

65  {
66  for (int i=0; i<N; ++i) data_[i] *= t;
67  return *this;
68  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
template<class U >
RKSmallVector& RKSmallVector< T, N >::operator+= ( const RKSmallVector< U, N > &  v)
inline

Operations with vector of same size.

Definition at line 38 of file RKSmallVector.h.

38  {
39  for (int i=0; i<N; ++i) data_[i] += v[i];
40  return *this;
41  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
RKSmallVector RKSmallVector< T, N >::operator- ( ) const
inline

Unary minus, returns a vector with negated components.

Definition at line 58 of file RKSmallVector.h.

58  {
60  for (int i=0; i<N; ++i) r[i] = -data_[i];
61  return r;
62  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
template<class U >
RKSmallVector& RKSmallVector< T, N >::operator-= ( const RKSmallVector< U, N > &  v)
inline

Definition at line 44 of file RKSmallVector.h.

44  {
45  for (int i=0; i<N; ++i) data_[i] -= v[i];
46  return *this;
47  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
RKSmallVector& RKSmallVector< T, N >::operator/= ( const T &  t)
inline

Scaling by a scalar value (division)

Definition at line 70 of file RKSmallVector.h.

70  {
71  for (int i=0; i<N; ++i) data_[i] /= t;
72  return *this;
73  }
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
const T& RKSmallVector< T, N >::operator[] ( int  i) const
inline

Definition at line 32 of file RKSmallVector.h.

32 {return data_[i];}
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
T& RKSmallVector< T, N >::operator[] ( int  i)
inline

Definition at line 33 of file RKSmallVector.h.

33 {return data_[i];}
int i
Definition: DBlmapReader.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:84
template<typename T, int N>
int RKSmallVector< T, N >::size ( void  ) const
inline

Definition at line 26 of file RKSmallVector.h.

Member Data Documentation

template<typename T, int N>
Scalar RKSmallVector< T, N >::data_[N]
private