List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
utl::SVector< n, T > Class Template Reference

Static (small and dense) vector class. More...

#include "utl/SVector.h"

Inheritance diagram for utl::SVector< n, T >:
Inheritance graph
[legend]

Public Types

enum  { Size = n }
 
typedef const T * ConstIterator
 
typedef T * Iterator
 
typedef T Type
 

Public Member Functions

template<typename V >
void Assign (const V &v)
 
T & At (const int i)
 Element access with bound checking. More...
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 
template<std::size_t i>
T & Get ()
 static getter More...
 
template<std::size_t i>
const T & Get () const
 static getter More...
 
double GetMag () const
 
void Normalize ()
 
template<std::size_t nn, typename U >
bool operator!= (const SVector< nn, U > &v) const
 
template<typename U >
SVectoroperator*= (const U &fact)
 
template<typename U >
SVectoroperator+= (const SVector< n, U > &v)
 
SVector operator- () const
 
template<typename U >
SVectoroperator-= (const SVector< n, U > &v)
 
template<typename U >
SVectoroperator/= (const U &div)
 
ListVectorAssignmentProxy
< SVector
operator= (const T &e)
 
template<typename V >
SVectoroperator= (const V &v)
 
template<std::size_t nn, typename U >
bool operator== (const SVector< nn, U > &v) const
 
T & operator[] (const std::size_t i)
 
const T & operator[] (const std::size_t i) const
 
 SVector ()=default
 Default constructor does not initialize data! More...
 
 SVector (const T &init)
 
template<class V >
 SVector (const V &v)
 

Static Public Member Functions

static std::size_t GetSize ()
 

Public Attributes

const T & const
 
double const
 
 mag2 = std::pow(std::abs(fVector[i]), 2)
 
return mag2
 
 void
 

Private Attributes

fVector [n]
 

Detailed Description

template<std::size_t n, typename T = double>
class utl::SVector< n, T >

Static (small and dense) vector class.

Power of unrolled loops.

Please refer to the testSMatrixSVector.cc file for usage cases.

Author
Darko Veberic
Date
10 Jun 2008

Definition at line 33 of file SVector.h.

Member Typedef Documentation

template<std::size_t n, typename T = double>
typedef const T* utl::SVector< n, T >::ConstIterator

Definition at line 132 of file SVector.h.

template<std::size_t n, typename T = double>
typedef T* utl::SVector< n, T >::Iterator

Definition at line 131 of file SVector.h.

template<std::size_t n, typename T = double>
typedef T utl::SVector< n, T >::Type

Definition at line 35 of file SVector.h.

Member Enumeration Documentation

template<std::size_t n, typename T = double>
anonymous enum
Enumerator
Size 

Definition at line 37 of file SVector.h.

Constructor & Destructor Documentation

template<std::size_t n, typename T = double>
utl::SVector< n, T >::SVector ( )
default

Default constructor does not initialize data!

template<std::size_t n, typename T = double>
utl::SVector< n, T >::SVector ( const T &  init)
inlineexplicit

Initialize all vector element to (scalar) value. Note that you have to match the type T explicitly.

Definition at line 49 of file SVector.h.

template<std::size_t n, typename T = double>
template<class V >
utl::SVector< n, T >::SVector ( const V v)
inlineexplicit

For all other types than T this ctor will be invoked. It assumes v is a vector-like type with operator[] access.

Definition at line 56 of file SVector.h.

Member Function Documentation

template<std::size_t n, typename T = double>
template<typename V >
void utl::SVector< n, T >::Assign ( const V v)
inline
template<std::size_t n, typename T = double>
T& utl::SVector< n, T >::At ( const int  i)
inline

Element access with bound checking.

Definition at line 101 of file SVector.h.

template<std::size_t n, typename T = double>
Iterator utl::SVector< n, T >::Begin ( )
inline

Definition at line 134 of file SVector.h.

Referenced by utl::SVector< 3, double >::operator-().

template<std::size_t n, typename T = double>
ConstIterator utl::SVector< n, T >::Begin ( ) const
inline

Definition at line 135 of file SVector.h.

template<std::size_t n, typename T = double>
Iterator utl::SVector< n, T >::End ( )
inline

Definition at line 137 of file SVector.h.

Referenced by utl::SVector< 3, double >::operator-().

template<std::size_t n, typename T = double>
ConstIterator utl::SVector< n, T >::End ( ) const
inline

Definition at line 138 of file SVector.h.

template<std::size_t n, typename T = double>
template<std::size_t i>
T& utl::SVector< n, T >::Get ( )
inline

static getter

Definition at line 125 of file SVector.h.

Referenced by TestSMatrixSVector::TestSVectorCtor().

template<std::size_t n, typename T = double>
template<std::size_t i>
const T& utl::SVector< n, T >::Get ( ) const
inline

static getter

Definition at line 129 of file SVector.h.

template<std::size_t n, typename T = double>
double utl::SVector< n, T >::GetMag ( ) const
inline

Definition at line 152 of file SVector.h.

Referenced by utl::Angle(), utl::CosAngle(), and utl::SVector< 3, double >::Normalize().

template<std::size_t n, typename T = double>
static std::size_t utl::SVector< n, T >::GetSize ( )
inlinestatic
template<std::size_t n, typename T = double>
void utl::SVector< n, T >::Normalize ( )
inline

Definition at line 155 of file SVector.h.

template<std::size_t n, typename T = double>
template<std::size_t nn, typename U >
bool utl::SVector< n, T >::operator!= ( const SVector< nn, U > &  v) const
inline

Definition at line 215 of file SVector.h.

template<std::size_t n, typename T = double>
template<typename U >
SVector& utl::SVector< n, T >::operator*= ( const U fact)
inline

Definition at line 167 of file SVector.h.

template<std::size_t n, typename T = double>
template<typename U >
SVector& utl::SVector< n, T >::operator+= ( const SVector< n, U > &  v)
inline

Definition at line 185 of file SVector.h.

template<std::size_t n, typename T = double>
SVector utl::SVector< n, T >::operator- ( ) const
inline

Definition at line 158 of file SVector.h.

template<std::size_t n, typename T = double>
template<typename U >
SVector& utl::SVector< n, T >::operator-= ( const SVector< n, U > &  v)
inline

Definition at line 194 of file SVector.h.

template<std::size_t n, typename T = double>
template<typename U >
SVector& utl::SVector< n, T >::operator/= ( const U div)
inline

Definition at line 176 of file SVector.h.

template<std::size_t n, typename T = double>
ListVectorAssignmentProxy<SVector> utl::SVector< n, T >::operator= ( const T &  e)
inline

Support for comma-separated initialization list. Gets invoked when first term in the comma-separated list matches the T type of the SVector class:

SVector<3, double> v;
v = 1., 2., 3.;

Definition at line 75 of file SVector.h.

template<std::size_t n, typename T = double>
template<typename V >
SVector& utl::SVector< n, T >::operator= ( const V v)
inline

Assigment of all other types is asummed to be in vector-like form with operator[] access.

Definition at line 86 of file SVector.h.

template<std::size_t n, typename T = double>
template<std::size_t nn, typename U >
bool utl::SVector< n, T >::operator== ( const SVector< nn, U > &  v) const
inline

Definition at line 203 of file SVector.h.

Referenced by utl::SVector< 3, double >::operator!=().

template<std::size_t n, typename T = double>
T& utl::SVector< n, T >::operator[] ( const std::size_t  i)
inline

Definition at line 95 of file SVector.h.

template<std::size_t n, typename T = double>
const T& utl::SVector< n, T >::operator[] ( const std::size_t  i) const
inline

Definition at line 97 of file SVector.h.

Member Data Documentation

template<std::size_t n, typename T = double>
const T& utl::SVector< n, T >::const
Initial value:
{
if (i < 0 || i >= n) {
std::ostringstream err;
err << "Index " << i << " out of bounds (" << n << ')';
throw utl::OutOfBoundException(err.str());
}
return fVector[i]

Definition at line 114 of file SVector.h.

template<std::size_t n, typename T = double>
double utl::SVector< n, T >::const
Initial value:
{
double mag2 = 0

Definition at line 145 of file SVector.h.

template<std::size_t n, typename T = double>
T utl::SVector< n, T >::fVector[n]
private
template<std::size_t n, typename T = double>
utl::SVector< n, T >::mag2 = std::pow(std::abs(fVector[i]), 2)

Definition at line 148 of file SVector.h.

template<std::size_t n, typename T = double>
return utl::SVector< n, T >::mag2

Definition at line 149 of file SVector.h.

template<std::size_t n, typename T = double>
utl::SVector< n, T >::void
Initial value:
{
fVector[i] = value

Definition at line 90 of file SVector.h.


The documentation for this class was generated from the following file:

, generated on Tue Sep 26 2023.