In file matrix.h:Class for arbitrary-length vectors.
Public Fields
-
Friend functions and overloaded operators
Public Methods
-
vector(void)
- constructor for zero-length (uninitialized) vectors
-
vector(int n)
- constructor for a vector of length n
-
vector(int n, const double* data)
- consructor for a vector of length n, with elements given by data
-
vector(const double f[3])
- constructor for a 3-vector with the given elements
-
vector(const triple &t)
- constructor for a 3-vector equal to t
-
vector(const vector &v)
- copy constructor
-
~vector(void)
- destructor
-
inline int size(void) const
- returns the size of the vector
-
void resize(int newsize)
- resizes the vector, destroying existing contents
-
void normalize(void)
- normalizes the vector so that it is unit-length
-
void negate(void)
- negates the vector
-
void print(FILE* fp) const
- prints the vector to a file
-
inline void set(const double* d)
- sets the vector's elements to the values pointed to by d
-
inline void setSlice(const vector &v, int n0)
- sets vn elements of the vector to v, starting at element n0
-
inline void setSlice(const double* d, int n0, int len)
- sets len elements of the vector to v, starting at element n0
-
inline void getSlice(int n0, vector &v)
- copies vn elements (starting at n0) into v
-
inline void getSlice(int n0, int len, double* d)
- copies len elements (starting at n0) into d
-
inline double* elem(void)
- returns a pointer to the vector's elements
-
inline const double* elem(void) const
- returns a pointer to the vector's elements
-
inline double& elem(int i)
- returns a reference to the i'th element
-
inline const double& elem(int i) const
- returns a reference to the i'th element
-
member overloaded operators
Documentation
Class for arbitrary-length vectors. Vectors have a small amount
of storage space (determined by the constant VECTOR_SPACE) so that
small vectors do not require dynamic memory.
- vector(void)
- constructor for zero-length (uninitialized) vectors
- vector(int n)
- constructor for a vector of length n
- vector(int n, const double* data)
- consructor for a vector of length n, with elements given by data
- vector(const double f[3])
- constructor for a 3-vector with the given elements
- vector(const triple &t)
- constructor for a 3-vector equal to t
- vector(const vector &v)
- copy constructor
- ~vector(void)
- destructor
- inline int size(void) const
- returns the size of the vector
- void resize(int newsize)
- resizes the vector, destroying existing contents
- void normalize(void)
- normalizes the vector so that it is unit-length
- void negate(void)
- negates the vector
- void print(FILE* fp) const
- prints the vector to a file
- inline void set(const double* d)
- sets the vector's elements to the values pointed to by d
- inline void setSlice(const vector &v, int n0)
- sets vn elements of the vector to v, starting at element n0
- inline void setSlice(const double* d, int n0, int len)
- sets len elements of the vector to v, starting at element n0
- inline void getSlice(int n0, vector &v)
- copies vn elements (starting at n0) into v
- inline void getSlice(int n0, int len, double* d)
- copies len elements (starting at n0) into d
- inline double* elem(void)
- returns a pointer to the vector's elements
- inline const double* elem(void) const
- returns a pointer to the vector's elements
- inline double& elem(int i)
- returns a reference to the i'th element
- inline const double& elem(int i) const
- returns a reference to the i'th element
- member overloaded operators
- inline double& operator()(int i)
- returns a reference to the i'th element
- inline const double& operator()(int i) const
- returns a reference to the i'th element
- vector& operator=(const vector &v)
- assignment operator
- vector& operator=(double d)
- assignment operator. d must be 0, and all entries of the vector
are zeroed
- vector& operator+=(const vector &v)
- addition operator
- vector& operator-=(const vector &v)
- subtraction operator
- vector& operator*=(double d)
- multiplication operator
- vector& operator/=(double d)
- division operator
- Friend functions and overloaded operators
- Friends:
- double abs(const vector &v)
double sqr(const vector &v)
vector normalize(const vector &v)
vector operator-(const vector &v)
vector operator+(const vector &v1,
vector operator/(const vector &v, double d)
vector operator-(const vector &v1,
triple operator^(const vector &v1,
vector operator*(const vector &v, double d)
vector operator*(double d, const vector &v)
double operator*(const vector &v1, const vector &v2)
vector operator *(const matrix &m, const vector &v)
vector operator *(const vector &v, const matrix &m)
vector &vadd(vector &r,
vector &vsub(vector &r,
triple &vcross(triple &r,
vector &vmult(vector &r, const vector &v1, const vector &v2)
vector &vdiv(vector &r, const vector &v1, const vector &v2)
int outerProduct(matrix &result, const vector &v1, const vector &v2)
- const vector& v2
- const vector& v1
- This class has no child classes.
- Friends:
- matrix
triple
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.