gridripper::math::MVector< T > Class Template Reference

Vector class. More...

#include <Matrix.h>

List of all members.

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.
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.
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.


Detailed Description

template<class T>
class gridripper::math::MVector< T >

Vector class.

Version:
GridRipper 12/21/2008
Author:
Peter Csizmadia
Since:
1991

Constructor & Destructor Documentation

template<class T>
gridripper::math::MVector< T >::MVector (  ) 

Constructs an empty zero-dimensional vector.

template<class T>
gridripper::math::MVector< T >::MVector ( int  d  ) 

Constructs a d-dimensional vector.

template<class T>
gridripper::math::MVector< T >::MVector ( const MVector< T > &  v  ) 

Copy constructor.


Member Function Documentation

template<class T>
virtual void gridripper::math::MVector< T >::setSize ( int  n  )  [virtual]

Sets the size, i.e.

the number of dimensions.

template<class T>
int gridripper::math::MVector< T >::size (  )  const [inline]

Returns the size, i.e.

the number of dimensions.

template<class T>
T& gridripper::math::MVector< T >::operator[] ( int  i  )  const [inline]

Gets a reference for a component with the specified index.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator= ( const MVector< T > &  b  ) 

Copies another vector onto this vector.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator= ( s  ) 

Sets all elements of this vector.

Parameters:
s the value
Returns:
this vector

template<class T>
bool gridripper::math::MVector< T >::operator== ( const MVector< T > &  b  )  const

Tests whether two vectors are equal.

template<class T>
bool gridripper::math::MVector< T >::operator!= ( const MVector< T > &  b  )  const [inline]

Tests whether two vectors are not equal.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator+ (  )  const [inline]

Unary plus operation.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator- (  )  const

Unary minus operation.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator+ ( const MVector< T > &  b  )  const

Adds two vectors.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator- ( const MVector< T > &  b  )  const

Subtracts a vectors.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator* ( s  )  const

Multiplies by a scalar.

template<class T>
MVector<T> gridripper::math::MVector< T >::operator/ ( s  )  const

Divides by a scalar.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator+= ( const MVector< T > &  b  ) 

Adds a vector.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator-= ( const MVector< T > &  b  ) 

Subtracts a vectors.

template<class T>
T gridripper::math::MVector< T >::operator* ( const MVector< T > &  v  )  const

Scalar multiplication.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator*= ( s  ) 

Multiplies the vector by a scalar.

template<class T>
MVector<T>& gridripper::math::MVector< T >::operator/= ( s  ) 

Divides the vector by a scalar.

template<class T>
T gridripper::math::MVector< T >::square (  ) 

Scalar multiplication of the vector by itself.


Friends And Related Function Documentation

template<class T>
template<class T2>
MVector<T2> operator* ( T2  s,
const MVector< T2 > &  v 
) [friend]

Multiplies a scalar by a vector.

template<class T>
template<class T2>
std::istream& operator>> ( std::istream &  is,
MVector< T2 > &  v 
) [friend]

Reads a vector from a stream.

template<class T>
template<class T2>
std::ostream& operator<< ( std::ostream &  os,
const MVector< T2 > &  v 
) [friend]

Writes a vector into a stream.


Member Data Documentation

template<class T>
T* gridripper::math::MVector< T >::x [protected]

Array of vector components.

template<class T>
int gridripper::math::MVector< T >::n [protected]

Vector dimension, i.e.

the number of components.


The documentation for this class was generated from the following file:

Generated on Wed Jun 17 18:46:55 2009 for GridRipper by  doxygen 1.5.6