#include <Matrix.h>
Public Member Functions | |
MVector () | |
Constructs an empty zero-dimensional vector. | |
MVector (int d) | |
Constructs a d-dimensional vector. | |
MVector (const MVector< T > &v) | |
Copy constructor. | |
virtual void | setSize (int n) |
Sets the size, i.e. | |
int | size () const |
Returns the size, i.e. | |
T & | operator[] (int i) const |
Gets a reference for a component with the specified index. | |
MVector< T > & | operator= (const MVector< T > &b) |
Copies another vector onto this vector. | |
MVector< T > & | operator= (T s) |
Sets all elements of this vector. | |
bool | operator== (const MVector< T > &b) const |
Tests whether two vectors are equal. | |
bool | operator!= (const MVector< T > &b) const |
Tests whether two vectors are not equal. | |
MVector< T > | operator+ () const |
Unary plus operation. | |
MVector< T > | operator- () const |
Unary minus operation. | |
MVector< T > | operator+ (const MVector< T > &b) const |
Adds two vectors. | |
MVector< T > | operator- (const MVector< T > &b) const |
Subtracts a vectors. | |
MVector< T > | operator* (T s) const |
Multiplies by a scalar. | |
MVector< T > | operator/ (T s) const |
Divides by a scalar. | |
MVector< T > & | operator+= (const MVector< T > &b) |
Adds a vector. | |
MVector< T > & | operator-= (const MVector< T > &b) |
Subtracts a vectors. | |
T | operator* (const MVector< T > &v) const |
Scalar multiplication. | |
MVector< T > & | operator*= (T s) |
Multiplies the vector by a scalar. | |
MVector< T > & | operator/= (T s) |
Divides the vector by a scalar. | |
T | square () |
Scalar multiplication of the vector by itself. | |
Protected Attributes | |
T * | x |
Array of vector components. | |
int | n |
Vector dimension, i.e. | |
Friends | |
template<class T2> | |
MVector< T2 > | operator* (T2 s, const MVector< T2 > &v) |
Multiplies a scalar by a vector. | |
template<class T2> | |
std::istream & | operator>> (std::istream &is, MVector< T2 > &v) |
Reads a vector from a stream. | |
template<class T2> | |
std::ostream & | operator<< (std::ostream &os, const MVector< T2 > &v) |
Writes a vector into a stream. |
gridripper::math::MVector< T >::MVector | ( | ) |
Constructs an empty zero-dimensional vector.
gridripper::math::MVector< T >::MVector | ( | int | d | ) |
Constructs a d-dimensional vector.
gridripper::math::MVector< T >::MVector | ( | const MVector< T > & | v | ) |
Copy constructor.
virtual void gridripper::math::MVector< T >::setSize | ( | int | n | ) | [virtual] |
Sets the size, i.e.
the number of dimensions.
int gridripper::math::MVector< T >::size | ( | ) | const [inline] |
Returns the size, i.e.
the number of dimensions.
T& gridripper::math::MVector< T >::operator[] | ( | int | i | ) | const [inline] |
Gets a reference for a component with the specified index.
MVector<T>& gridripper::math::MVector< T >::operator= | ( | const MVector< T > & | b | ) |
Copies another vector onto this vector.
MVector<T>& gridripper::math::MVector< T >::operator= | ( | T | s | ) |
Sets all elements of this vector.
s | the value |
bool gridripper::math::MVector< T >::operator== | ( | const MVector< T > & | b | ) | const |
Tests whether two vectors are equal.
bool gridripper::math::MVector< T >::operator!= | ( | const MVector< T > & | b | ) | const [inline] |
Tests whether two vectors are not equal.
MVector<T> gridripper::math::MVector< T >::operator+ | ( | ) | const [inline] |
Unary plus operation.
MVector<T> gridripper::math::MVector< T >::operator- | ( | ) | const |
Unary minus operation.
MVector<T> gridripper::math::MVector< T >::operator+ | ( | const MVector< T > & | b | ) | const |
Adds two vectors.
MVector<T> gridripper::math::MVector< T >::operator- | ( | const MVector< T > & | b | ) | const |
Subtracts a vectors.
MVector<T> gridripper::math::MVector< T >::operator* | ( | T | s | ) | const |
Multiplies by a scalar.
MVector<T> gridripper::math::MVector< T >::operator/ | ( | T | s | ) | const |
Divides by a scalar.
MVector<T>& gridripper::math::MVector< T >::operator+= | ( | const MVector< T > & | b | ) |
Adds a vector.
MVector<T>& gridripper::math::MVector< T >::operator-= | ( | const MVector< T > & | b | ) |
Subtracts a vectors.
T gridripper::math::MVector< T >::operator* | ( | const MVector< T > & | v | ) | const |
Scalar multiplication.
MVector<T>& gridripper::math::MVector< T >::operator*= | ( | T | s | ) |
Multiplies the vector by a scalar.
MVector<T>& gridripper::math::MVector< T >::operator/= | ( | T | s | ) |
Divides the vector by a scalar.
T gridripper::math::MVector< T >::square | ( | ) |
Scalar multiplication of the vector by itself.
MVector<T2> operator* | ( | T2 | s, | |
const MVector< T2 > & | v | |||
) | [friend] |
Multiplies a scalar by a vector.
std::istream& operator>> | ( | std::istream & | is, | |
MVector< T2 > & | v | |||
) | [friend] |
Reads a vector from a stream.
std::ostream& operator<< | ( | std::ostream & | os, | |
const MVector< T2 > & | v | |||
) | [friend] |
Writes a vector into a stream.
T* gridripper::math::MVector< T >::x [protected] |
Array of vector components.
int gridripper::math::MVector< T >::n [protected] |
Vector dimension, i.e.
the number of components.