Library of Assembled Shared Sources
|
a dynamic sized n-dimensional vector with vector expression templates More...
#include <spline_cubic.h>
Public Member Functions | |
Vector () | |
constructs an empty vector | |
Vector (TSize iDimension, TParam iInitialValue=TNumTraits::zero) | |
Construct a vector of dimension iDimension. | |
Vector (const TStorage &iStorage) | |
construct vector from storage type | |
template<typename VectorType> | |
Vector (const VectorType &iVector) | |
contruct by any particular type supporting [] and size(). | |
template<typename T2, typename S2> | |
Vector (const Vector< T2, S2 > &iOther) | |
construct storage/expression vector to this (this should be a storage vector). | |
template<typename T2, typename S2> | |
Vector< T, S > & | operator= (const Vector< T2, S2 > &iOther) |
assign storage/expression vector to this (this should be a storage vector). | |
TSize | size () const |
return dimension of vector. | |
const TValue | operator[] (TSize iIndex) const |
return the iIndex'th component value. | |
TReference | operator[] (TSize iIndex) |
access the iIndex'th component value. | |
const TValue | at (TSize iIndex) const |
return the iIndex'th component value and wrap index if necessary. | |
TReference | at (TSize iIndex) |
access the iIndex'th component value and wrap index if necessary. | |
const Vector< T, S > & | operator+ () const |
A weird way to get back the same object. | |
const Vector< T, impl::VNeg< T, S > > | operator- () const |
return a vector with all components negated (-v)[i] == -(v[i]). | |
template<typename T2, typename S2> | |
Vector< T, S > & | operator+= (const Vector< T2, S2 > &iB) |
add storage/expression vector to this (this should be a storage vector). | |
template<typename T2, typename S2> | |
Vector< T, S > & | operator-= (const Vector< T2, S2 > &iB) |
subtract storage/expression vector from this (this should be a storage vector). | |
template<typename T2, typename S2> | |
Vector< T, S > & | operator*= (const Vector< T2, S2 > &iB) |
multiply storage/expression vector with this (this should be a storage vector). | |
template<typename T2, typename S2> | |
Vector< T, S > & | operator/= (const Vector< T2, S2 > &iB) |
divide this by storage/expression vector (this should be a storage vector). | |
template<typename T2> | |
Vector< T, S > & | operator+= (const T2 &iB) |
add iB to all components | |
template<typename T2> | |
Vector< T, S > & | operator-= (const T2 &iB) |
subtract iB from all components | |
template<typename T2> | |
Vector< T, S > & | operator*= (const T2 &iB) |
multiply all components with iB. | |
template<typename T2> | |
Vector< T, S > & | operator/= (const T2 &iB) |
divide all components by iB. | |
bool | isEmpty () const |
return true if vector contains no dataa at all | |
bool | isZero () const |
Return true if all the components are (exactly!) zero. | |
const TValue | sum () const |
Return sum of all components of vector. | |
const TValue | min () const |
Return minimum of all components of vector. | |
const TValue | max () const |
Return maximum of all components of vector. | |
const TValue | squaredNorm () const |
Return squared norm of vector. | |
const TValue | norm () const |
Return norm of vector. | |
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::VRec< T, S > > | reciprocal () const |
return a vector with each component being the reciprocal value of this vector. | |
template<typename S2> | |
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > | project (const Vector< T, S2 > &iB) const |
Project vector on this one. | |
template<typename S2> | |
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. | |
void | normalize () |
Normalize vector. | |
void | swap (Vector< T, S > &iOther) |
swap storage of two vectors | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T, typename S1, typename S2> | |
Vector< T, impl::MVRightProd< T, S1, S2 > > | operator* (const Matrix< T, S1 > &iA, const Vector< T, S2 > &iB) |
multiply matrix with column vector | |
template<typename T, typename S> | |
Matrix< T, impl::MVDiag< T, S > > | diagonal (const Vector< T, S > &iB) |
Create diagonal matrix from vector. | |
template<typename T, typename S> | |
void | solve (const Matrix< T, S > &iA, Vector< T > &iB) |
Solves set of equation A * X == B. | |
template<typename T, typename S1, typename S2> | |
const T | dot (const Vector< T, S1 > &iA, const Vector< T, S2 > &iB) |
dot product. | |
template<typename T, typename S1, typename S2> | |
const Vector< T, impl::VAdd< T, S1, S2 > > | operator+ (const Vector< T, S1 > &iA, const Vector< T, S2 > &iB) |
componentwise addition | |
template<typename T, typename S1, typename S2> | |
const Vector< T, impl::VSub< T, S1, S2 > > | operator- (const Vector< T, S1 > &iA, const Vector< T, S2 > &iB) |
componentwise subtraction | |
template<typename T, typename S1, typename S2> | |
const Vector< T, impl::VMul< T, S1, S2 > > | operator* (const Vector< T, S1 > &iA, const Vector< T, S2 > &iB) |
componentwise multiplication | |
template<typename T, typename S1, typename S2> | |
const Vector< T, impl::VDiv< T, S1, S2 > > | operator/ (const Vector< T, S1 > &iA, const Vector< T, S2 > &iB) |
componentwise division | |
template<typename T, typename S> | |
const Vector< T, impl::VAdd< T, impl::VScalar< T >, S > > | operator+ (const T &iA, const Vector< T, S > &iB) |
add iA to all components of iB | |
template<typename T, typename S> | |
const Vector< T, impl::VSub< T, impl::VScalar< T >, S > > | operator- (const T &iA, const Vector< T, S > &iB) |
add iA to all negated components of iB | |
template<typename T, typename S> | |
const Vector< T, impl::VMul< T, impl::VScalar< T >, S > > | operator* (const T &iA, const Vector< T, S > &iB) |
multiply iA with all components of iB | |
template<typename T, typename S> | |
const Vector< T, impl::VDiv< T, impl::VScalar< T >, S > > | operator/ (const T &iA, const Vector< T, S > &iB) |
multiply iA with all reciprocal components of iB | |
template<typename T, typename S> | |
const Vector< T, impl::VAdd< T, S, impl::VScalar< T > > > | operator+ (const Vector< T, S > &iA, const T &iB) |
add iB to all components of iA | |
template<typename T, typename S> | |
const Vector< T, impl::VSub< T, S, impl::VScalar< T > > > | operator- (const Vector< T, S > &iA, const T &iB) |
subtract iB from all components of iA | |
template<typename T, typename S> | |
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > | operator* (const Vector< T, S > &iA, const T &iB) |
multiply all components of iA with iB. | |
template<typename T, typename S> | |
const Vector< T, impl::VDiv< T, S, impl::VScalar< T > > > | operator/ (const Vector< T, S > &iA, const T &iB) |
multiply all components of iA with iB. | |
a dynamic sized n-dimensional vector with vector expression templates
lass::num::Vector< T, S >::Vector | ( | ) |
constructs an empty vector
Definition at line 73 of file vector.inl.
References size().
|
explicit |
Construct a vector of dimension iDimension.
iDimension | the dimension of the vector to be created. You can pass zero, but you shouldn't pass negative dimensions though. |
iInitialValue | the initial value of all vector components, zero by default. |
Definition at line 93 of file vector.inl.
|
explicit |
construct vector from storage type
Definition at line 109 of file vector.inl.
|
explicit |
contruct by any particular type supporting [] and size().
Should only be used with writable storage type (like std::vector which is the default).
Definition at line 127 of file vector.inl.
lass::num::Vector< T, S >::Vector | ( | const Vector< T2, S2 > & | iOther | ) |
construct storage/expression vector to this (this should be a storage vector).
this
must be an l-value.Definition at line 146 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator= | ( | const Vector< T2, S2 > & | iOther | ) |
assign storage/expression vector to this (this should be a storage vector).
this
must be an l-value.Definition at line 170 of file vector.inl.
|
inline |
return dimension of vector.
this should never be a negative value.
Definition at line 191 of file vector.inl.
Referenced by dot(), operator*(), operator*(), operator*=(), operator+(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator[](), operator[](), and Vector().
|
inline |
return the iIndex'th component value.
Definition at line 207 of file vector.inl.
References size().
|
inline |
access the iIndex'th component value.
this
must be an l-value.Definition at line 226 of file vector.inl.
References size().
|
inline |
return the iIndex'th component value and wrap index if necessary.
if iIndex is out of the range [0, this->size()), it will be wrapped to map in this range. This is simply a modulus operation: mod(iIndex, this->size()).
Definition at line 242 of file vector.inl.
|
inline |
access the iIndex'th component value and wrap index if necessary.
if iIndex is out of the range [0, this->size()), it will be wrapped to map in this range. This is simply a modulus operation: mod(iIndex, this->size()).
this
must be an l-value.Definition at line 260 of file vector.inl.
|
inline |
A weird way to get back the same object.
Definition at line 277 of file vector.inl.
const Vector< T, impl::VNeg< T, S > > lass::num::Vector< T, S >::operator- | ( | ) | const |
return a vector with all components negated (-v)[i] == -(v[i]).
Definition at line 295 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator+= | ( | const Vector< T2, S2 > & | iB | ) |
add storage/expression vector to this (this should be a storage vector).
this
must be an l-value.Definition at line 317 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator-= | ( | const Vector< T2, S2 > & | iB | ) |
subtract storage/expression vector from this (this should be a storage vector).
this
must be an l-value.Definition at line 344 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator*= | ( | const Vector< T2, S2 > & | iB | ) |
multiply storage/expression vector with this (this should be a storage vector).
this
must be an l-value.Definition at line 371 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator/= | ( | const Vector< T2, S2 > & | iB | ) |
divide this by storage/expression vector (this should be a storage vector).
this
must be an l-value.Definition at line 398 of file vector.inl.
Vector< T, S > & lass::num::Vector< T, S >::operator+= | ( | const T2 & | iB | ) |
add iB to all components
this
must be an l-value.Definition at line 420 of file vector.inl.
References size().
Vector< T, S > & lass::num::Vector< T, S >::operator-= | ( | const T2 & | iB | ) |
subtract iB from all components
this
must be an l-value.Definition at line 441 of file vector.inl.
References size().
Vector< T, S > & lass::num::Vector< T, S >::operator*= | ( | const T2 & | iB | ) |
multiply all components with iB.
this
must be an l-value.Definition at line 462 of file vector.inl.
References size().
Vector< T, S > & lass::num::Vector< T, S >::operator/= | ( | const T2 & | iB | ) |
divide all components by iB.
this
must be an l-value.Definition at line 483 of file vector.inl.
References size().
|
inline |
return true if vector contains no dataa at all
Definition at line 503 of file vector.inl.
bool lass::num::Vector< T, S >::isZero | ( | ) | const |
Return true if all the components are (exactly!) zero.
Definition at line 516 of file vector.inl.
const Vector< T, S >::TValue lass::num::Vector< T, S >::sum | ( | ) | const |
Return sum of all components of vector.
Definition at line 540 of file vector.inl.
const Vector< T, S >::TValue lass::num::Vector< T, S >::min | ( | ) | const |
Return minimum of all components of vector.
Definition at line 560 of file vector.inl.
const Vector< T, S >::TValue lass::num::Vector< T, S >::max | ( | ) | const |
Return maximum of all components of vector.
Definition at line 584 of file vector.inl.
const Vector< T, S >::TValue lass::num::Vector< T, S >::squaredNorm | ( | ) | const |
Return squared norm of vector.
Definition at line 609 of file vector.inl.
References lass::num::sqr().
const Vector< T, S >::TValue lass::num::Vector< T, S >::norm | ( | ) | const |
Return norm of vector.
Definition at line 630 of file vector.inl.
References squaredNorm().
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > lass::num::Vector< T, S >::normal | ( | ) | const |
return a unit vector with same direction/sense as this vector.
The normalized vector of X is a vector in the same direction but with norm (length) 1. It is denoted X^ and given by X^ = X / |X|, http://mathworld.wolfram.com/dimension_ormalizedVector.html.
Definition at line 650 of file vector.inl.
References lass::num::norm().
const Vector< T, impl::VRec< T, S > > lass::num::Vector< T, S >::reciprocal | ( | ) | const |
return a vector with each component being the reciprocal value of this vector.
Definition at line 666 of file vector.inl.
const Vector< T, impl::VMul< T, S, impl::VScalar< T > > > lass::num::Vector< T, S >::project | ( | const Vector< T, S2 > & | iB | ) | const |
Project vector on this one.
Definition at line 684 of file vector.inl.
References dot(), and squaredNorm().
Referenced by reject().
const Vector< T, impl::VSub< T, S2, impl::VMul< T, S, impl::VScalar< T > > > > lass::num::Vector< T, S >::reject | ( | const Vector< T, S2 > & | iB | ) | const |
Project vector on this one.
Definition at line 704 of file vector.inl.
References project().
void lass::num::Vector< T, S >::normalize | ( | ) |
Normalize vector.
this
must be an l-value.Definition at line 719 of file vector.inl.
References lass::num::norm().
void lass::num::Vector< T, S >::swap | ( | Vector< T, S > & | iOther | ) |
swap storage of two vectors
this
and @ a iOther must be l-valuesDefinition at line 755 of file vector.inl.
|
Create diagonal matrix from vector.
Definition at line 89 of file matrix_vector.inl.
Solves set of equation A * X == B.
Definition at line 103 of file matrix_vector.inl.
|
dot product.
Definition at line 842 of file vector.inl.
Referenced by project().
|
componentwise addition
Definition at line 868 of file vector.inl.
|
componentwise subtraction
Definition at line 887 of file vector.inl.
|
componentwise multiplication
Definition at line 906 of file vector.inl.
|
componentwise division
Definition at line 925 of file vector.inl.
|
multiply iA with all reciprocal components of iB
Definition at line 990 of file vector.inl.