#include <vector.h>
Public Member Functions | |
Vector () | |
constructor matrix without size | |
Vector (int n, const T &val=T(0)) | |
constructor initilize with value | |
Vector (int n, const T *v) | |
constructor, initialize with array | |
Vector (const Vector &A) | |
copy constructor | |
~Vector () | |
destructor | |
Vector & | operator= (const Vector &a) |
Vector & | newsize (int n) |
new size | |
Vector & | clear () |
set all elements to zero | |
Vector & | operator= (const T &v) |
int | dim () const |
vector size | |
int | size () const |
bool | is_data () const |
T & | operator() (int i) |
set and get an matrix element without boundary check | |
const T & | operator() (int i) const |
void | read (istream &is) |
read matrix | |
void | print (ostream &os) const |
print matrix | |
Vector & | operator*= (T s) |
Vector & | operator/= (T s) |
division by a scalar | |
Protected Member Functions | |
void | allocate (int n) |
dot product | |
void | free () |
free memory | |
void | copy (const T *v) |
copy array | |
void | set (const T &val) |
set all elements to value | |
Protected Attributes | |
int | _n |
vector dimension | |
T * | _data |
vector elements |
General vector class.
void GenLib2::Vector< T >::allocate | ( | int | n | ) | [inline, protected] |
dot product
allocate memory
References GenLib2::Vector< T >::_data, and GenLib2::Vector< T >::_n.
Referenced by GenLib2::Vector< T >::newsize(), and GenLib2::Vector< T >::Vector().