My Project
|
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) |
gcp::util::Vector< type >::Vector | ( | unsigned | n | ) |
Constructor
....................................................................... Constructor
gcp::util::Vector< type >::Vector | ( | type | el0, |
type | el1, | ||
type | el2 | ||
) |
Constructor
....................................................................... Constructor with three arguments
gcp::util::Vector< type >::Vector | ( | const Vector< type > & | vec | ) |
Copy constructor
....................................................................... Copy constructor
|
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
gcp::util::Vector< type >::Vector | ( | ) |
Private constructor with no arguments
....................................................................... Constructor
double gcp::util::Vector< type >::magnitude | ( | ) |
Get the magnitude of a vector
const type gcp::util::Vector< type >::operator* | ( | const Vector< type > & | vec | ) |
Assignment void operator=(const Vector<type>& vec); Vector multiplication
....................................................................... Multiply two vectors together
const Vector< type > gcp::util::Vector< type >::operator* | ( | const type | factor | ) |
....................................................................... Multiply a vector by a constant
const Vector< type > gcp::util::Vector< type >::operator+ | ( | const Vector< type > & | vec | ) |
Vector addition
....................................................................... Add two vectors together
const Vector< type > gcp::util::Vector< type >::operator+ | ( | const type | offset | ) |
....................................................................... Add a constant to a vector
const Vector< type > gcp::util::Vector< type >::operator- | ( | const Vector< type > & | vec | ) |
....................................................................... Subtraction
....................................................................... Subtract two vectors
const Vector< type > gcp::util::Vector< type >::operator- | ( | const type | offset | ) |
....................................................................... Subtract a constant to a vector
....................................................................... Subtract a constant from a vector
const Vector< type > gcp::util::Vector< type >::operator/ | ( | const type | factor | ) |
....................................................................... Divide a vector by a constant
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
|
inline |
Private resize operator
|
inline |
Query the size of the vector.
|
friend |
Declare a vector printing method
|
friend |
Declare a vector printing method