My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
gcp::util::Vector< type > Class Template Reference

Public Member Functions

 Vector (unsigned n)
 
 Vector (type el0, type el1, type el2)
 
 Vector (const Vector< type > &vec)
 
virtual ~Vector ()
 
unsigned size ()
 
double magnitude ()
 
type & operator[] (unsigned i)
 
const type operator* (const Vector< type > &vec)
 
const Vector< type > operator+ (const Vector< type > &vec)
 
const Vector< type > operator- (const Vector< type > &vec)
 
const Vector< type > operator* (const type factor)
 
const Vector< type > operator/ (const type factor)
 
const Vector< type > operator+ (const type offset)
 
const Vector< type > operator- (const type offset)
 
void add (Vector< type > vec)
 
void push_back (type el)
 
 Vector ()
 
void resize (unsigned n)
 

Protected Attributes

std::vector< type > data_
 

Friends

class Matrix< type >
 
std::ostream & gcp::util::operator<< (std::ostream &os, const Vector< type > &vec)
 
std::ostringstream & gcp::util::operator<< (std::ostringstream &os, const Vector< type > &vec)
 

Constructor & Destructor Documentation

template<class type >
gcp::util::Vector< type >::Vector ( unsigned  n)

Constructor

....................................................................... Constructor

template<class type>
gcp::util::Vector< type >::Vector ( type  el0,
type  el1,
type  el2 
)

Constructor

....................................................................... Constructor with three arguments

template<class type>
gcp::util::Vector< type >::Vector ( const Vector< type > &  vec)

Copy constructor

....................................................................... Copy constructor

template<class type >
gcp::util::Vector< type >::~Vector ( )
virtual

Destructor.

....................................................................... Assignment

template<class type> void Vector<type>::operator=(const Vector<type>& vec) { cout << "Inside Vector assignment operator" << endl; cout << "vec.data_.size() = " << vec.data_.size() << endl;

 data_.resize(vec.data_.size());
 for(unsigned i=0; i < vec.data_.size(); i++) 
 data_[i] = vec.data_[i];

cout << "data_.size() = " << data_.size() << endl; }....................................................................... Destructor

template<class type>
gcp::util::Vector< type >::Vector ( )

Private constructor with no arguments

....................................................................... Constructor

Member Function Documentation

template<class type >
double gcp::util::Vector< type >::magnitude ( )

Get the magnitude of a vector

template<class type>
const type gcp::util::Vector< type >::operator* ( const Vector< type > &  vec)

Assignment void operator=(const Vector<type>& vec); Vector multiplication

....................................................................... Multiply two vectors together

template<class type>
const Vector< type > gcp::util::Vector< type >::operator* ( const type  factor)

....................................................................... Multiply a vector by a constant

template<class type>
const Vector< type > gcp::util::Vector< type >::operator+ ( const Vector< type > &  vec)

Vector addition

....................................................................... Add two vectors together

template<class type>
const Vector< type > gcp::util::Vector< type >::operator+ ( const type  offset)

....................................................................... Add a constant to a vector

template<class type>
const Vector< type > gcp::util::Vector< type >::operator- ( const Vector< type > &  vec)

....................................................................... Subtraction

....................................................................... Subtract two vectors

template<class type>
const Vector< type > gcp::util::Vector< type >::operator- ( const type  offset)

....................................................................... Subtract a constant to a vector

....................................................................... Subtract a constant from a vector

template<class type>
const Vector< type > gcp::util::Vector< type >::operator/ ( const type  factor)

....................................................................... Divide a vector by a constant

template<class type >
type & gcp::util::Vector< type >::operator[] ( unsigned  i)

Define an operator for accessing elements of the vector

....................................................................... Define an operator for accessing elements of the vector

template<class type>
void gcp::util::Vector< type >::resize ( unsigned  n)
inline

Private resize operator

template<class type>
unsigned gcp::util::Vector< type >::size ( )
inline

Query the size of the vector.

Friends And Related Function Documentation

template<class type>
std::ostream& gcp::util::operator<< ( std::ostream &  os,
const Vector< type > &  vec 
)
friend

Declare a vector printing method

template<class type>
std::ostringstream& gcp::util::operator<< ( std::ostringstream &  os,
const Vector< type > &  vec 
)
friend

Declare a vector printing method

template<class type>
friend class Matrix< type >
friend

Only Matrix can resize us.


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