Resources

Topics

RobWorkProject
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions
Q Class Reference

Configuration vector. More...

#include <Q.hpp>

Public Types

typedef boost::numeric::ublas::vector< double > BoostVector
 Boost vector type.
 
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > Base
 Eigen vector used as internal datastructure.
 
typedef double value_type
 Value type.
 

Public Member Functions

 Q (size_t dim)
 A configuration of vector of length dim.
 
 Q ()
 Default constructor. More...
 
 Q (size_t n, const double *values)
 Creates a Q of length n and initialized with values from values. More...
 
 Q (size_t n, double value)
 Creates a Q of length n and initialize all values in Q to value. More...
 
 Q (size_t n, double a0, double a1)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4, double a5)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4, double a5, double a6)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (size_t n, double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9)
 Creates a Q of length n and initialize all values in Q to the values specified after n. More...
 
 Q (const std::vector< double > &r)
 Construct a configuration vector from a std::vector expression. More...
 
 Q (const Base &q)
 Construct from Eigen base. More...
 
virtual ~Q ()
 Destructor.
 
size_t size () const
 The dimension of the configuration vector.
 
bool empty () const
 True if the configuration is of dimension zero.
 
template<class R >
 Q (const boost::numeric::ublas::vector_expression< R > &r)
 Construct a configuration vector from a Boost vector expression. More...
 
BoostVector m () const
 Accessor for the internal Boost vector state.
 
const Basee () const
 Accessor for the internal Boost vector state.
 
Basee ()
 Accessor for the internal Boost vector state.
 
const Q getSubPart (size_t start, size_t cnt) const
 Start of sequence iterator. More...
 
void setSubPart (size_t index, const Q &part)
 Set subpart of vector. More...
 
double norm2 () const
 Returns the Euclidean norm (2-norm) of the configuration. More...
 
double norm1 () const
 Returns the Manhatten norm (1-norm) of the configuration. More...
 
double normInf () const
 Returns the infinte norm ( $\inf$-norm) of the configuration. More...
 
const double & operator() (size_t i) const
 Returns reference to vector element. More...
 
double & operator() (size_t i)
 Returns reference to vector element. More...
 
const double & operator[] (size_t i) const
 Returns reference to vector element. More...
 
double & operator[] (size_t i)
 Returns reference to vector element. More...
 
const Q operator/ (double s) const
 Scalar division.
 
const Q operator* (double s) const
 Scalar multiplication.
 
const Q operator- (const Q &b) const
 Vector subtraction.
 
const Q operator+ (const Q &b) const
 Vector addition.
 
Qoperator*= (double s)
 Scalar multiplication.
 
Qoperator/= (double s)
 Scalar division.
 
Qoperator+= (const Q &v)
 Vector addition.
 
Qoperator-= (const Q &v)
 Vector subtraction.
 
Q operator- () const
 Unary minus.
 
bool operator< (const Q &q) const
 Compares whether this is less than q. More...
 
void toStdVector (std::vector< double > &v)
 Convert to a standard vector. More...
 
std::vector< double > toStdVector ()
 Convert to a standard vector. More...
 

Static Public Member Functions

static Q zero (std::size_t n)
 Returns Q of length n initialized with 0's.
 

Friends

const Q operator* (double s, const Q &v)
 Scalar multiplication.
 
const Q operator/ (double s, const Q &v)
 Scalar division.
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::ostream & operator<< (std::ostream &out, const Pose6D< T > &v)
 Streaming operator.
 
bool operator== (const Q &q1, const Q &q2)
 Compares q1 and q2 for equality. More...
 
std::ostream & operator<< (std::ostream &out, const Q &v)
 Streaming operator.
 
std::istream & operator>> (std::istream &in, Q &q)
 Input streaming operator. More...
 
double dot (const Q &a, const Q &b)
 The dot product (inner product) of a and b.
 
template<>
void write (const rw::math::Q &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void read (rw::math::Q &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 

Detailed Description

Configuration vector.

Constructor & Destructor Documentation

Q ( )
inline

Default constructor.

The vector will be of dimension zero.

Q ( size_t  n,
const double *  values 
)

Creates a Q 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
Q ( size_t  n,
double  value 
)

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

Parameters
n[in] Length of q.
value[in] Value to initialize
Q ( size_t  n,
double  a0,
double  a1 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
double  a6 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
double  a6,
double  a7 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
double  a6,
double  a7,
double  a8 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( size_t  n,
double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
double  a6,
double  a7,
double  a8,
double  a9 
)

Creates a Q of length n and initialize all values in Q to the values specified after n.

The number of arguments after n must match the number n.

Parameters
n[in] Length of q.
a0[in] Value to initialize q(0)
a1[in] Value to initialize q(1)
...[in] Values to initialize [q(2);q(n-1)]
Q ( const std::vector< double > &  r)
inline

Construct a configuration vector from a std::vector expression.

Parameters
r[in] An expression for a vector of doubles
Q ( const Base q)
inline

Construct from Eigen base.

Parameters
q[in] Eigen base.
Q ( const boost::numeric::ublas::vector_expression< 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

const Q 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 Q.

Parameters
start[in] Start index
cnt[in] the number of elements to include
Returns
double norm1 ( ) const
inline

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

Returns
the norm
double norm2 ( ) const
inline

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

Returns
the norm
double normInf ( ) const
inline

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

Returns
the norm
const double& operator() ( size_t  i) const
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
const reference to element
double& operator() ( size_t  i)
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
reference to element
bool operator< ( const Q 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.

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

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
const reference to element
double& operator[] ( size_t  i)
inline

Returns reference to vector element.

Parameters
i[in] index in the vector
Returns
reference to element
void setSubPart ( size_t  index,
const Q part 
)
inline

Set subpart of vector.

Parameters
index[in] the initial index.
part[in] the part to insert beginning from index.
void toStdVector ( std::vector< double > &  v)
inline

Convert to a standard vector.

Parameters
v[out] the result.
std::vector<double> toStdVector ( )
inline

Convert to a standard vector.

Returns
the result.

Friends And Related Function Documentation

bool operator== ( const Q q1,
const Q 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.
std::istream & operator>> ( std::istream &  in,
Q 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
void read ( rw::math::Q sobject,
rw::common::InputArchive iarchive,
const std::string &  id 
)
related

Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.

Parameters
sobject[out] the object in which the data should be streamed into
iarchive[in] the InputArchive from which to read data.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.
void write ( const rw::math::Q sobject,
rw::common::OutputArchive oarchive,
const std::string &  id 
)
related

Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.

Parameters
sobject[in] the object from which the data should be streamed.
oarchive[out] the OutputArchive in which data should be written.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

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