IMP  2.1.1
The Integrative Modeling Platform
IMP::algebra::VectorD< D > Class Template Reference

A Cartesian vector in D-dimensions. More...

#include <IMP/algebra/VectorD.h>

+ Inheritance diagram for IMP::algebra::VectorD< D >:

Public Types

typedef const double * CoordinateConstIterator
 
typedef double * CoordinateIterator
 

Public Member Functions

 VectorD (const Floats &f)
 
template<class It >
 VectorD (It b, It e)
 
 VectorD (double x)
 Initialize the 1-vector from its value.
 
 VectorD (double x, double y)
 Initialize a 2-vector from separate x,y values.
 
 VectorD (double x, double y, double z)
 Initialize a 3-vector from separate x,y,z values.
 
 VectorD (double x0, double x1, double x2, double x3)
 Initialize a 4-vector from separate w,x,y,z values.
 
 VectorD ()
 Default constructor.
 
CoordinateIterator coordinates_begin ()
 
CoordinateConstIterator coordinates_begin () const
 
CoordinateIterator coordinates_end ()
 
CoordinateConstIterator coordinates_end () const
 
Floats get_coordinates () const
 
unsigned int get_dimension () const
 
double get_magnitude () const
 
double get_scalar_product (const VectorD< D > &o) const
 
double get_squared_magnitude () const
 
VectorD get_unit_vector () const
 
double operator[] (unsigned int i) const
 
double & operator[] (unsigned int i)
 

Detailed Description

template<int D>
class IMP::algebra::VectorD< D >

Store a vector of Cartesian coordinates. It supports all expected mathematical operators, including using * for the dot product.

See Also
Vector3D
Vector2D

See geometric primitives for more information.

Definition at line 48 of file VectorD.h.

Constructor & Destructor Documentation

template<int D>
IMP::algebra::VectorD< D >::VectorD ( const Floats f)
Exceptions
base::ValueExceptionif f.size() is not appropriate.
Note
Only use this from python.

Definition at line 101 of file VectorD.h.

template<int D>
template<class It >
IMP::algebra::VectorD< D >::VectorD ( It  b,
It  e 
)

The distance between b and e must be equal to D.

Definition at line 112 of file VectorD.h.

Member Function Documentation

template<int D>
VectorD IMP::algebra::VectorD< D >::get_unit_vector ( ) const

Returns a unit vector pointing at the same direction as this vector.

Note
If the magnitude of this vector is smaller than 1e-12 (an arbitrarily selected small number), returns a unit vector pointing at a random direction

Definition at line 204 of file VectorD.h.

template<int D>
double IMP::algebra::VectorD< D >::operator[] ( unsigned int  i) const

Return the ith Cartesian coordinate. In 3D use [0] to get the x coordinate etc.

Definition at line 171 of file VectorD.h.

template<int D>
double& IMP::algebra::VectorD< D >::operator[] ( unsigned int  i)

Return the ith Cartesian coordinate. In 3D use [0] to get the x coordinate etc.

Definition at line 178 of file VectorD.h.


The documentation for this class was generated from the following file: