CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

RKSmallVector< T, N > Class Template Reference

#include <RKSmallVector.h>

List of all members.

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.
template<class U >
RKSmallVectorincrement (const RKSmallVector< U, N > &v, const T &t)
 Increment by another vector multiplied by a scalar.
const Toperator() (int i) const
 access to values
Toperator() (int i)
RKSmallVectoroperator*= (const T &t)
 Scaling by a scalar value (multiplication)
template<class U >
RKSmallVectoroperator+= (const RKSmallVector< U, N > &v)
 Operations with vector of same size.
RKSmallVector operator- () const
 Unary minus, returns a vector with negated components.
template<class U >
RKSmallVectoroperator-= (const RKSmallVector< U, N > &v)
RKSmallVectoroperator/= (const T &t)
 Scaling by a scalar value (division)
Toperator[] (int i)
const Toperator[] (int i) const
 RKSmallVector (const Scalar *d)
 Construct from array.
 RKSmallVector ()
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.

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

Construct from array.

Definition at line 16 of file RKSmallVector.h.

                                  {
    for (int i=0; i<N; ++i) data_[i] = d[i];
  }
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.

                                                            {
    for (int i=0; i<N; i++) data_[i] = *begin++;
  }

Member Function Documentation

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

Definition at line 27 of file RKSmallVector.h.

{return N;}
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.

                                       {
    RKSmallVector r;
    for (int i=0; i<N; ++i) r[i] = data_[i]*data_[i];
    return r;
  }
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.

                                                                     {
    for (int i=0; i<N; ++i) data_[i] += t*v[i];
    return *this;
  } 
template<typename T, int N>
T& RKSmallVector< T, N >::operator() ( int  i) [inline]

Definition at line 31 of file RKSmallVector.h.

{return data_[i];}
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.

{return data_[i];}
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.

                                          {
    for (int i=0; i<N; ++i) data_[i] *= t;
    return *this;
  }
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.

                                                           {
    for (int i=0; i<N; ++i) data_[i] += v[i];
    return *this;
  } 
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.

                                  { 
    RKSmallVector r;
    for (int i=0; i<N; ++i) r[i] = -data_[i];
    return r;
  }
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.

                                                           {
    for (int i=0; i<N; ++i) data_[i] -= v[i];
    return *this;
  } 
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.

                                          {
    for (int i=0; i<N; ++i) data_[i] /= t;
    return *this;
  }
template<typename T, int N>
const T& RKSmallVector< T, N >::operator[] ( int  i) const [inline]

Definition at line 32 of file RKSmallVector.h.

{return data_[i];}
template<typename T, int N>
T& RKSmallVector< T, N >::operator[] ( int  i) [inline]

Definition at line 33 of file RKSmallVector.h.

{return data_[i];}
template<typename T, int N>
int RKSmallVector< T, N >::size ( void  ) const [inline]

Definition at line 26 of file RKSmallVector.h.

{return N;}

Member Data Documentation

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