In file matrix.h:

class vector

Class for arbitrary-length vectors.

Public Fields

[more] Friend functions and overloaded operators

Public Methods

[more] vector(void)
constructor for zero-length (uninitialized) vectors
[more] vector(int n)
constructor for a vector of length n
[more] vector(int n, const double* data)
consructor for a vector of length n, with elements given by data
[more] vector(const double f[3])
constructor for a 3-vector with the given elements
[more] vector(const triple &t)
constructor for a 3-vector equal to t
[more] vector(const vector &v)
copy constructor
[more] ~vector(void)
destructor
[more]inline int size(void) const
returns the size of the vector
[more]void resize(int newsize)
resizes the vector, destroying existing contents
[more]void normalize(void)
normalizes the vector so that it is unit-length
[more]void negate(void)
negates the vector
[more]void print(FILE* fp) const
prints the vector to a file
[more]inline void set(const double* d)
sets the vector's elements to the values pointed to by d
[more]inline void setSlice(const vector &v, int n0)
sets vn elements of the vector to v, starting at element n0
[more]inline void setSlice(const double* d, int n0, int len)
sets len elements of the vector to v, starting at element n0
[more]inline void getSlice(int n0, vector &v)
copies vn elements (starting at n0) into v
[more]inline void getSlice(int n0, int len, double* d)
copies len elements (starting at n0) into d
[more]inline double* elem(void)
returns a pointer to the vector's elements
[more]inline const double* elem(void) const
returns a pointer to the vector's elements
[more]inline double& elem(int i)
returns a reference to the i'th element
[more]inline const double& elem(int i) const
returns a reference to the i'th element
[more] 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.
o vector(void)
constructor for zero-length (uninitialized) vectors

o vector(int n)
constructor for a vector of length n

o vector(int n, const double* data)
consructor for a vector of length n, with elements given by data

o vector(const double f[3])
constructor for a 3-vector with the given elements

o vector(const triple &t)
constructor for a 3-vector equal to t

o vector(const vector &v)
copy constructor

o ~vector(void)
destructor

oinline int size(void) const
returns the size of the vector

ovoid resize(int newsize)
resizes the vector, destroying existing contents

ovoid normalize(void)
normalizes the vector so that it is unit-length

ovoid negate(void)
negates the vector

ovoid print(FILE* fp) const
prints the vector to a file

oinline void set(const double* d)
sets the vector's elements to the values pointed to by d

oinline void setSlice(const vector &v, int n0)
sets vn elements of the vector to v, starting at element n0

oinline void setSlice(const double* d, int n0, int len)
sets len elements of the vector to v, starting at element n0

oinline void getSlice(int n0, vector &v)
copies vn elements (starting at n0) into v

oinline void getSlice(int n0, int len, double* d)
copies len elements (starting at n0) into d

oinline double* elem(void)
returns a pointer to the vector's elements

oinline const double* elem(void) const
returns a pointer to the vector's elements

oinline double& elem(int i)
returns a reference to the i'th element

oinline const double& elem(int i) const
returns a reference to the i'th element

o member overloaded operators

oinline double& operator()(int i)
returns a reference to the i'th element

oinline const double& operator()(int i) const
returns a reference to the i'th element

ovector& operator=(const vector &v)
assignment operator

ovector& operator=(double d)
assignment operator. d must be 0, and all entries of the vector are zeroed

ovector& operator+=(const vector &v)
addition operator

ovector& operator-=(const vector &v)
subtraction operator

ovector& operator*=(double d)
multiplication operator

ovector& operator/=(double d)
division operator

o 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)

oconst vector& v2

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