RobWorkProject  23.9.11-
Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
Vector< T > Class Template Reference

Configuration vector. More...

#include <Vector.hpp>

Public Types

typedef Eigen::Matrix< T, Eigen::Dynamic, 1 > Base
 The type of the internal Eigen vector implementation.
 

Public Member Functions

 Vector (size_t dim)
 A configuration of vector of length dim.
 
 Vector ()
 Default constructor. More...
 
 Vector (size_t n, const T *values)
 Creates a Vector of length n and initialized with values from values. More...
 
 Vector (size_t n, T value)
 Creates a Vector of length n and initialize all values in Vector to value. More...
 
size_t size () const
 The dimension of the configuration vector.
 
bool empty () const
 True if the configuration is of dimension zero.
 
template<class R >
 Vector (const Eigen::MatrixBase< R > &r)
 Construct a configuration vector from a Boost vector expression. More...
 
const Basee () const
 Accessor for the internal Eigen vector state.
 
Basee ()
 Accessor for the internal Eigen vector state.
 
const Vector getSubPart (size_t start, size_t cnt) const
 Start of sequence iterator. More...
 
void setSubPart (size_t index, const Vector &part)
 Set a part of the vector. More...
 
norm2 () const
 Returns the Euclidean norm (2-norm) of the configuration. More...
 
norm1 () const
 Returns the Manhatten norm (1-norm) of the configuration. More...
 
normInf () const
 Returns the infinte norm ( \(\inf\)-norm) of the configuration. More...
 
const T & operator() (size_t i) const
 Returns reference to vector element. More...
 
T & operator() (size_t i)
 Returns reference to vector element. More...
 
const T & operator[] (size_t i) const
 Returns reference to vector element. More...
 
T & operator[] (size_t i)
 Returns reference to vector element. More...
 
const Vector operator/ (T s) const
 Scalar division.
 
const Vector operator* (T s) const
 Scalar multiplication.
 
const Vector operator- (const Vector &b) const
 Vector subtraction.
 
const Vector operator+ (const Vector &b) const
 Vector addition.
 
Vectoroperator*= (T s)
 Scalar multiplication.
 
Vectoroperator/= (T s)
 Scalar division.
 
Vectoroperator+= (const Vector &v)
 Vector addition.
 
Vectoroperator-= (const Vector &v)
 Vector subtraction.
 
const Vector operator- () const
 Unary minus.
 
bool operator< (const Vector &q) const
 Compares whether this is less than q. More...
 

Static Public Member Functions

static Vector zero (int n)
 Returns Vector of length n initialized with 0's.
 

Friends

const Vector operator* (T s, const Vector &v)
 Scalar multiplication.
 

Related Functions

(Note that these are not member functions.)

template<class A >
bool operator== (const Vector< A > &q1, const Vector< A > &q2)
 Compares q1 and q2 for equality. More...
 
template<class A >
std::ostream & operator<< (std::ostream &out, const Vector< A > &v)
 Streaming operator.
 
template<class A >
std::istream & operator>> (std::istream &in, Vector< A > &q)
 Input streaming operator. More...
 
template<class A >
dot (const Vector< A > &a, const Vector< A > &b)
 The dot product (inner product) of a and b.
 

Detailed Description

template<class T = double>
class rw::math::Vector< T >

Configuration vector.

Constructor & Destructor Documentation

◆ Vector() [1/4]

Vector ( )
inline

Default constructor.

The vector will be of dimension zero.

◆ Vector() [2/4]

Vector ( size_t  n,
const T *  values 
)
inline

Creates a Vector of length n and initialized with values from values.

The method reads n values from values and do not check whether reading out of bounds.

Parameters
n[in] Length of q.
values[in] Values to initialize with

◆ Vector() [3/4]

Vector ( size_t  n,
value 
)
inline

Creates a Vector of length n and initialize all values in Vector to value.

Parameters
n[in] Length of q.
value[in] Value to initialize

◆ Vector() [4/4]

Vector ( const Eigen::MatrixBase< R > &  r)
inlineexplicit

Construct a configuration vector from a Boost vector expression.

Parameters
r[in] An expression for a vector of doubles

Member Function Documentation

◆ getSubPart()

const Vector getSubPart ( size_t  start,
size_t  cnt 
) const
inline

Start of sequence iterator.

End of sequence iterator.

Start of sequence iterator.

End of sequence iterator.

Extracts a sub part (range) of this Vector.

Parameters
start[in] Start index
cnt[in] the number of elements to include
Returns

◆ norm1()

T norm1 ( ) const
inline

Returns the Manhatten norm (1-norm) of the configuration.

Returns
the norm

◆ norm2()

T norm2 ( ) const
inline

Returns the Euclidean norm (2-norm) of the configuration.

Returns
the norm

◆ normInf()

T normInf ( ) const
inline

Returns the infinte norm ( \(\inf\)-norm) of the configuration.

Returns
the norm

◆ operator()() [1/2]

T& operator() ( size_t  i)
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
reference to element

◆ operator()() [2/2]

const T& operator() ( size_t  i) const
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
const reference to element

◆ operator<()

bool operator< ( const Vector< T > &  q) const
inline

Compares whether this is less than q.

The less operator is defined such that the first index is the most significant. That is if (*this)[0] < q[0] then true is returned. If (*this)[0] > q[0] false is returned and only if (*this)[0] == q[0] is the next index considered.

◆ operator[]() [1/2]

T& operator[] ( size_t  i)
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
reference to element

◆ operator[]() [2/2]

const T& operator[] ( size_t  i) const
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
const reference to element

◆ setSubPart()

void setSubPart ( size_t  index,
const Vector< T > &  part 
)
inline

Set a part of the vector.

Parameters
index[in] first index.
part[in] the subpart to set.

Friends And Related Function Documentation

◆ operator==()

bool operator== ( const Vector< A > &  q1,
const Vector< A > &  q2 
)
related

Compares q1 and q2 for equality.

q1 and q2 are considered equal if and only if they have equal length and if q1(i) == q2(i) for all i.

Parameters
q1[in]
q2[in]
Returns
True if q1 equals q2, false otherwise.

◆ operator>>()

std::istream & operator>> ( std::istream &  in,
Vector< A > &  q 
)
related

Input streaming operator.

Parse input stream according to how operator<< streams out

Parameters
in[in] Input stream
q[in] Target of q read in
Returns
reference to in

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