Vector whose length is known at compile time.
More...
Inherits ltl::FVMemory< T, N, S >.
List of all members.
Public Types
- enum { static_size = 1
}
Used by expression engine to decide which loops to unroll.
More...
Public Member Functions
- FVector ()
- default constructor
- ~FVector ()
- destructor
- FVector (const FVector< T, N, S > &other)
- copy constructor
- FVector (T *const a)
- FVector (const T t)
- fill with value
t
.
- template<class Expr > FVector (const FVExprNode< Expr, N > &e)
- construct from expression
- ListInitializationSwitch
< FVector< T, N, S > > operator= (T x)
- Initialize with list of values or single value.
- iterator begin ()
- return an iterator pointing to the first element.
- const_iterator begin () const
- return a const iterator pointing to the first element.
- iterator end ()
- return an iterator pointing past the last element.
- const_iterator end () const
- return a const iterator pointing past the last element.
- void fill (const T x)
- fill with value
x
.
- template<class T2 , int S2> void swap (FVector< T2, N, S2 > &other)
- swap values with
other
.
- T * data ()
- Return a pointer to the data.
- T * data () const
- Return a const pointer to the data.
|
|
- T operator[] (const int i) const
- Access elements with zero-based index
i
.
- T & operator[] (const int i)
- Access elements with zero-based index
i
.
- T operator() (const int i) const
- Access elements with one-based index
i
.
- T & operator() (const int i)
- Access elements with one-based index
i
.
Static Public Member Functions
- static int length ()
- return length of vector.
- static int minIndex ()
- lowest possible index, always one.
- static int maxIndex ()
- highest possible index, always N.
Protected Attributes
- T * __data_
- points to first element of data block for 0-based access
Friends
- typedef T value_type
- STL-compatible type definitions.
- typedef FVIter< T, N, S > iterator
- typedef FVIterConst< T, N, S > const_iterator
- typedef T * pointer
- typedef const T * const_pointer
- typedef T & reference
- typedef const T & const_reference
- typedef std::size_t size_type
- typedef std::ptrdiff_t difference_type
- static size_type size ()
- STL return the length of the vector.
- static bool empty ()
- STL
empty()
. Always false.
- static size_type max_size ()
- STL: Maximum capacity. Always
==size
().
- template<class Expr > FVector< T, N, S > & operator= (const FVExprNode< Expr, N > &e)
operatorX=
for expression rhs.
- template<class Expr > FVector< T, N, S > & operator+= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator-= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator*= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator/= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator%= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator^= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator&= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator|= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator<<= (const FVExprNode< Expr, N > &e)
- template<class Expr > FVector< T, N, S > & operator>>= (const FVExprNode< Expr, N > &e)
- template<class T2 , int S2> FVector< T, N, S > & operator= (const FVector< T2, N, S2 > &v)
- operatorX for
FVector
rhs.
- FVector< T, N, S > & operator= (const FVector< T, N, S > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator+= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator-= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator*= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator/= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator%= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator^= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator&= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator|= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator<<= (const FVector< T2, N, S2 > &v)
- template<class T2 , int S2> FVector< T, N, S > & operator>>= (const FVector< T2, N, S2 > &v)
- FVector< T, N, S > & operator+= (const T t)
- operatorX= for scalar rhs.
- FVector< T, N, S > & operator-= (const T t)
- FVector< T, N, S > & operator*= (const T t)
- FVector< T, N, S > & operator/= (const T t)
- FVector< T, N, S > & operator%= (const T t)
- FVector< T, N, S > & operator^= (const T t)
- FVector< T, N, S > & operator&= (const T t)
- FVector< T, N, S > & operator|= (const T t)
- FVector< T, N, S > & operator<<= (const T t)
- FVector< T, N, S > & operator>>= (const T t)
Detailed Description
template<class T, int N, int S = 0>
class ltl::FVector< T, N, S >
Vector whose length is known at compile time.
Can either have its own memory region or reference foreign memory, for example when representing a column-vector of a matrix
The template parameter S is a 'stride' for the foreign memory: when we reference a column vector we need a stride of M (if the matrix is MxN). Memory handling is encapsulated in the class FVMemory. To make life easier for the compiler/optimizer, there is a specialization of FVMemory with _no_ stride at all and an own new embedded block of memory. This is indicated by S=0, which is also the default case.
FVector
does not require more memory than is necessary to store the N elements of the vector if S=0. If S>0, the size is exactly sizeof(T*)
.
FVector
provides operator() for 1-based access and operator[] for 0-based access. A full expression-templated engine for evaluating expressions involving ltl::FVectors is provided, as well as dot products between ltl::FVector and ltl::FMatrix objects, and scalar-valued reductions.
STL-compatible iterators and types.
Member Typedef Documentation
template<class T, int N, int S = 0>
STL-compatible type definitions.
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
Member Enumeration Documentation
template<class T, int N, int S = 0>
Used by expression engine to decide which loops to unroll.
- Enumerator:
-
Constructor & Destructor Documentation
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
constructor taking a pointer to foreign memory. If S==0
, copy, else reference the foreign memory.
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class Expr >
construct from expression
Member Function Documentation
template<class T, int N, int S = 0>
STL return the length of the vector.
Functions needed for STL container conformance
template<class T, int N, int S = 0>
static bool ltl::FVector< T, N, S >::empty |
( |
|
) |
[inline, static] |
template<class T, int N, int S = 0>
STL: Maximum capacity. Always ==size
().
template<class T, int N, int S = 0>
Initialize with list of values or single value.
Assign values through initialization list. A bit more comlicated since we have to discriminate between A = 3; and A = 1, 2, 3, 4; which is done using ListInitializationSwitch which either calls ListInitializer
or FVector::fill()
.
template<class T, int N, int S = 0>
return length of vector.
operator[] and operator() inherited from FVMemory
template<class T, int N, int S = 0>
lowest possible index, always one.
template<class T, int N, int S = 0>
highest possible index, always N.
template<class T, int N, int S = 0>
return an iterator pointing to the first element.
template<class T, int N, int S = 0>
return a const iterator pointing to the first element.
template<class T, int N, int S = 0>
return an iterator pointing past the last element.
template<class T, int N, int S = 0>
return a const iterator pointing past the last element.
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
operatorX=
for expression rhs.
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator+= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator-= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator*= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator/= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator%= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator^= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator&= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator|= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator<<= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class Expr >
FVector<T,N,S>& ltl::FVector< T, N, S >::operator>>= |
( |
const FVExprNode< Expr, N > & |
e |
) |
[inline] |
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S = 0>
operatorX= for scalar rhs.
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T, int N, int S = 0>
template<class T2 , int S2>
template<class T, int N, int S>
T ltl::FVMemory< T, N, S >::operator[] |
( |
const int |
i |
) |
const [inline, inherited] |
Access elements with zero-based index i
.
template<class T, int N, int S>
Access elements with zero-based index i
.
template<class T, int N, int S>
T ltl::FVMemory< T, N, S >::operator() |
( |
const int |
i |
) |
const [inline, inherited] |
Access elements with one-based index i
.
template<class T, int N, int S>
Access elements with one-based index i
.
template<class T, int N, int S>
Return a pointer to the data.
template<class T, int N, int S>
Return a const pointer to the data.
Friends And Related Function Documentation
template<class T, int N, int S = 0>
friend class FVIter< T, N, S > [friend] |
template<class T, int N, int S = 0>
friend class FVIterConst< T, N, S > [friend] |
template<class T, int N, int S = 0>
friend class ListInitializationSwitch< FVector< T, N, S > > [friend] |
Member Data Documentation
template<class T, int N, int S>
points to first element of data block for 0-based access
Referenced by ltl::FVMemory< T, N, 0 >::data(), ltl::FVMemory< double, N, 0 >::data(), ltl::FVMemory< T, N, 0 >::operator()(), ltl::FVMemory< double, N, 0 >::operator()(), ltl::FVMemory< T, N, 0 >::operator[](), and ltl::FVMemory< double, N, 0 >::operator[]().