run-time (dynamic) vector More...
Public Member Functions | |
Vector () | |
default constructor - no allocation | |
Vector (unsigned n) | |
construct with n elements | |
T & | operator() (unsigned i) |
mutable index operator | |
T const & | operator() (unsigned i) const |
immutable index operator | |
Vector< T, 0 > & | operator+= (Vector< T, 0 > const &b) |
add a vector to this vector | |
Vector< T, 0 > & | operator-= (Vector< T, 0 > const &b) |
subtract a vector from this vector | |
Vector< T, 0 > & | operator*= (T const &s) |
multiply this vector by a scalar | |
Vector< T, 0 > & | operator/= (T const &s) |
divide this vector by a scalar | |
T | getLength () const |
get the vector magnitude | |
void | zero () |
zero the vector |
run-time (dynamic) vector
A runtime-sized equivalent of mth::Vector<T,N>. All values are stored in a single dynamically allocated array. Due to the use of dynamic allocation, users should avoid copying class as much as possible. To help with this, we provide things like operator+= instead of operator+ to discourage users from creating temporary copies. The code for these methods is inlined in an effort to keep linear algebra running quickly
Definition at line 132 of file mthVector.h.
T& mth::Vector< T, 0 >::operator() | ( | unsigned | i | ) | [inline] |
mutable index operator
An index operator (i) is provided so that mth::Vector and mth::Matrix share a common index operator
Definition at line 142 of file mthVector.h.
{return (*this)[i];}