50#ifndef LASS_GUARDIAN_OF_INCLUSION_NUM_VECTOR_H
51#define LASS_GUARDIAN_OF_INCLUSION_NUM_VECTOR_H
68 typename S = impl::VStorage<T>
74 typedef Vector<T, S> TSelf;
77 typedef typename util::CallTraits<T>::TValue TValue;
78 typedef typename util::CallTraits<T>::TParam TParam;
79 typedef typename util::CallTraits<T>::TReference TReference;
80 typedef typename util::CallTraits<T>::TConstReference TConstReference;
81 typedef num::NumTraits<T> TNumTraits;
84 template <
typename U>
struct Rebind
86 typedef Vector<U, S> Type;
90 explicit Vector(TSize iDimension, TParam iInitialValue = TNumTraits::zero);
91 explicit Vector(
const TStorage& iStorage);
92 template <
typename VectorType>
explicit Vector(
const VectorType& iVector);
93 template <
typename T2,
typename S2>
Vector(
const Vector<T2, S2>& iOther);
95 template <
typename T2,
typename S2> Vector<T, S>&
operator=(
const Vector<T2, S2>& iOther);
101 const TValue
at(TSize iIndex)
const;
102 TReference
at(TSize iIndex);
106 template <
typename T2,
typename S2> Vector<T, S>&
operator+=(
const Vector<T2, S2>& iB);
107 template <
typename T2,
typename S2> Vector<T, S>&
operator-=(
const Vector<T2, S2>& iB);
108 template <
typename T2,
typename S2> Vector<T, S>&
operator*=(
const Vector<T2, S2>& iB);
109 template <
typename T2,
typename S2> Vector<T, S>&
operator/=(
const Vector<T2, S2>& iB);
110 template <
typename T2> Vector<T, S>&
operator+=(
const T2& iB);
111 template <
typename T2> Vector<T, S>&
operator-=(
const T2& iB);
112 template <
typename T2> Vector<T, S>&
operator*=(
const T2& iB);
113 template <
typename T2> Vector<T, S>&
operator/=(
const T2& iB);
122 const Vector<T, impl::VMul<T, S, impl::VScalar<T> > >
normal()
const;
125 template <
typename S2>
const Vector<T, impl::VMul<T, S, impl::VScalar<T> > >
127 template <
typename S2>
const Vector<T, impl::VSub<T, S2, impl::VMul<T, S, impl::VScalar<T> > > >
130 const Vector<T, impl::VFun<T, S> > transform(T (*iOperator)(T));
134 const TStorage& storage()
const;
136 void swap(Vector<T, S>& iOther);
140 template <
typename T2,
typename S2>
friend class Vector;
142 template <
typename IntegralType>
void init(IntegralType iDimension, meta::Wrap<meta::True>);
143 template <
typename VectorType>
void init(
const VectorType& iVector, meta::Wrap<meta::False>);
148template <
typename T,
typename S1,
typename S2>
150template <
typename T,
typename S1,
typename S2>
153template <
typename T,
typename S1,
typename S2>
156template <
typename T,
typename S1,
typename S2>
158template <
typename T,
typename S1,
typename S2>
160template <
typename T,
typename S1,
typename S2>
162template <
typename T,
typename S1,
typename S2>
165template <
typename T,
typename S>
167template <
typename T,
typename S>
169template <
typename T,
typename S>
171template <
typename T,
typename S>
174template <
typename T,
typename S>
176template <
typename T,
typename S>
178template <
typename T,
typename S>
180template <
typename T,
typename S>
184template <
typename T,
typename S,
typename Char,
typename Traits>
185std::basic_ostream<Char, Traits>&
186operator<<(std::basic_ostream<Char, Traits>& iS,
const Vector<T, S>& iA);
188template <
typename T,
typename S,
typename Char,
typename Traits>
189std::basic_istream<Char, Traits>&
190operator>>(std::basic_istream<Char, Traits>& iS,
Vector<T>& iB);
198#ifdef LASS_GUARDIAN_OF_INCLUSION_NUM_MATRIX_H
a dynamic sized n-dimensional vector with vector expression templates
bool isZero() const
Return true if all the components are (exactly!) zero.
Vector< T, S > & operator-=(const T2 &iB)
subtract iB from all components
const TValue sum() const
Return sum of all components of vector.
const TValue operator[](TSize iIndex) const
return the iIndex'th component value.
Vector(TSize iDimension, TParam iInitialValue=TNumTraits::zero)
Construct a vector of dimension iDimension.
const TValue squaredNorm() const
Return squared norm of vector.
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > project(const Vector< T, S2 > &iB) const
Project vector on this one.
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > normal() const
return a unit vector with same direction/sense as this vector.
const Vector< T, impl::VNeg< T, S > > operator-() const
return a vector with all components negated (-v)[i] == -(v[i]).
void swap(Vector< T, S > &iOther)
swap storage of two vectors
Vector(const VectorType &iVector)
contruct by any particular type supporting [] and size().
const TValue min() const
Return minimum of all components of vector.
Vector< T, S > & operator*=(const Vector< T2, S2 > &iB)
multiply storage/expression vector with this (this should be a storage vector).
const TValue norm() const
Return norm of vector.
Vector< T, S > & operator=(const Vector< T2, S2 > &iOther)
assign storage/expression vector to this (this should be a storage vector).
Vector< T, S > & operator/=(const Vector< T2, S2 > &iB)
divide this by storage/expression vector (this should be a storage vector).
const Vector< T, impl::VRec< T, S > > reciprocal() const
return a vector with each component being the reciprocal value of this vector.
bool isEmpty() const
return true if vector contains no dataa at all
Vector< T, S > & operator*=(const T2 &iB)
multiply all components with iB.
const Vector< T, impl::VSub< T, S2, impl::VMul< T, S, impl::VScalar< T > > > > reject(const Vector< T, S2 > &iB) const
Project vector on this one.
TSize size() const
return dimension of vector.
Vector(const TStorage &iStorage)
construct vector from storage type
TReference at(TSize iIndex)
access the iIndex'th component value and wrap index if necessary.
Vector< T, S > & operator/=(const T2 &iB)
divide all components by iB.
Vector< T, S > & operator+=(const T2 &iB)
add iB to all components
const Vector< T, S > & operator+() const
A weird way to get back the same object.
Vector(const Vector< T2, S2 > &iOther)
construct storage/expression vector to this (this should be a storage vector).
Vector< T, S > & operator+=(const Vector< T2, S2 > &iB)
add storage/expression vector to this (this should be a storage vector).
const TValue at(TSize iIndex) const
return the iIndex'th component value and wrap index if necessary.
Vector< T, S > & operator-=(const Vector< T2, S2 > &iB)
subtract storage/expression vector from this (this should be a storage vector).
const TValue max() const
Return maximum of all components of vector.
Vector()
constructs an empty vector
void normalize()
Normalize vector.
TReference operator[](TSize iIndex)
access the iIndex'th component value.
numeric types and traits.
Library for Assembled Shared Sources.