Represents a vector in N-dimensional space. More...
#include <Vector.h>
Public Member Functions | |
WONTON_INLINE | Vector () |
Default constructor - zero Vector in D-space. More... | |
WONTON_INLINE | Vector (const double &xm_comp) |
Initialize all components to same value (also constructor for 1d vectors) More... | |
WONTON_INLINE | Vector (const double &xm_comp, const double &ym_comp) |
Specialized constructor for 2d Vectors. More... | |
WONTON_INLINE | Vector (const double &xm_comp, const double &ym_comp, const double &zm_comp) |
Specialized constructor for 3d Vectors. More... | |
Vector (std::vector< double > const &invec) | |
Constructor from a std:vector. More... | |
WONTON_INLINE const double & | operator[] (const int &i) const |
Return component i of the Vector. More... | |
WONTON_INLINE double & | operator[] (const int &i) |
Return component i of the Vector. More... | |
WONTON_INLINE Vector | operator- () const |
Negative of this vector. More... | |
WONTON_INLINE Vector & | operator+= (const Vector< D > &rhs) |
Add the Vector rhs to this Vector. More... | |
WONTON_INLINE Vector & | operator-= (const Vector< D > &rhs) |
Subtract the Vector rhs from this vector. More... | |
WONTON_INLINE Vector & | operator*= (const double &s) |
Scalar multiplication of this Vector by s . More... | |
WONTON_INLINE Vector & | operator/= (const double &s) |
Scalar division of this Vector by s . More... | |
WONTON_INLINE double | norm (bool doSqrt=true) const |
Calculate the norm of a Vector. More... | |
WONTON_INLINE double | one_norm () const |
Calculate the 1-norm of a Vector. More... | |
WONTON_INLINE double | max_norm () const |
Calculate the max norm of a Vector. More... | |
WONTON_INLINE void | normalize () |
Convert this Vector into a unit Vector. More... | |
WONTON_INLINE void | zero () |
Convert this Vector into a zero Vector. More... | |
WONTON_INLINE bool | is_zero (double dst_tol) const |
Check if this Vector is a zero Vector. More... | |
WONTON_INLINE void | fill (double val) |
Convenience method for constructing a Vector with all components equal to a given value. More... | |
WONTON_INLINE void | axis (int nonZero) |
Convenience method for constructing a unit Vector along a particular axis. More... | |
std::istream & | readFromStream (std::istream &is) |
Read in a Vector from an input stream. More... | |
std::ostream & | writeToStream (std::ostream &os) const |
Pretty printing of a Vector to an output stream. More... | |
Detailed Description
template<int D>
class Wonton::Vector< D >
Represents a vector in N-dimensional space.
- Template Parameters
-
D Indicates the dimensionality of the Vector (this will generally be one of [1, 2, 3]).
Constructor & Destructor Documentation
◆ Vector() [1/5]
|
inline |
Default constructor - zero Vector in D-space.
◆ Vector() [2/5]
|
inline |
Initialize all components to same value (also constructor for 1d vectors)
- Parameters
-
[in] xm_comp The x coordinate.
◆ Vector() [3/5]
|
inline |
Specialized constructor for 2d Vectors.
- Parameters
-
[in] xm_comp,ym_comp The (x,y) coordinate pair.
◆ Vector() [4/5]
|
inline |
Specialized constructor for 3d Vectors.
- Parameters
-
[in] xm_comp,ym_comp,zm_comp The (x,y,z) coordinate triple.
◆ Vector() [5/5]
|
inline |
Constructor from a std:vector.
Member Function Documentation
◆ axis()
|
inline |
◆ fill()
|
inline |
Convenience method for constructing a Vector with all components equal to a given value.
- Parameters
-
[in] value Value to assign to all the components
◆ is_zero()
|
inline |
◆ max_norm()
|
inline |
Calculate the max norm of a Vector.
◆ norm()
|
inline |
◆ normalize()
|
inline |
◆ one_norm()
|
inline |
Calculate the 1-norm of a Vector.
◆ operator*=()
|
inline |
Scalar multiplication of this Vector by s
.
◆ operator+=()
|
inline |
◆ operator-()
|
inline |
Negative of this vector.
◆ operator-=()
|
inline |
Subtract the Vector rhs
from this vector.
◆ operator/=()
|
inline |
Scalar division of this Vector by s
.
◆ operator[]() [1/2]
|
inline |
Return component i
of the Vector.
◆ operator[]() [2/2]
|
inline |
Return component i
of the Vector.
◆ readFromStream()
|
inline |
Read in a Vector from an input stream.
◆ writeToStream()
|
inline |
Pretty printing of a Vector to an output stream.
◆ zero()
|
inline |
The documentation for this class was generated from the following file:
- /home/wonton/wonton/wonton/support/Vector.h