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
 
T 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 Toperator() (int i) const
 access to values More...
 
Toperator() (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 Toperator[] (int i) const
 
Toperator[] (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 10 of file RKSmallVector.h.

Member Typedef Documentation

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

Definition at line 12 of file RKSmallVector.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file RKSmallVector.h.

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

Construct from array.

Definition at line 17 of file RKSmallVector.h.

17  {
18  for (int i=0; i<N; ++i) data_[i] = d[i];
19  }
int i
Definition: DBlmapReader.cc:9
#define N
Definition: blowfish.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:85
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 23 of file RKSmallVector.h.

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

Member Function Documentation

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

Definition at line 28 of file RKSmallVector.h.

28 {return N;}
#define N
Definition: blowfish.cc:9
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 77 of file RKSmallVector.h.

77  {
79  for (int i=0; i<N; ++i) r[i] = data_[i]*data_[i];
80  return r;
81  }
int i
Definition: DBlmapReader.cc:9
#define N
Definition: blowfish.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:85
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 52 of file RKSmallVector.h.

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

access to values

Definition at line 31 of file RKSmallVector.h.

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

Scaling by a scalar value (multiplication)

Definition at line 66 of file RKSmallVector.h.

66  {
67  for (int i=0; i<N; ++i) data_[i] *= t;
68  return *this;
69  }
int i
Definition: DBlmapReader.cc:9
#define N
Definition: blowfish.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:85
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 39 of file RKSmallVector.h.

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

Unary minus, returns a vector with negated components.

Definition at line 59 of file RKSmallVector.h.

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

Definition at line 45 of file RKSmallVector.h.

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

Scaling by a scalar value (division)

Definition at line 71 of file RKSmallVector.h.

71  {
72  for (int i=0; i<N; ++i) data_[i] /= t;
73  return *this;
74  }
int i
Definition: DBlmapReader.cc:9
#define N
Definition: blowfish.cc:9
Scalar data_[N]
Definition: RKSmallVector.h:85
template<typename T, int N>
const T& RKSmallVector< T, N >::operator[] ( int  i) const
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:85
template<typename T, int N>
T& RKSmallVector< T, N >::operator[] ( int  i)
inline

Definition at line 34 of file RKSmallVector.h.

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

Definition at line 27 of file RKSmallVector.h.

27 {return N;}
#define N
Definition: blowfish.cc:9

Member Data Documentation

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

Definition at line 85 of file RKSmallVector.h.