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

Configuration vector. More...

#include <Q.hpp>

Public Types

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.
 
const Basee () const
 Accessor for the internal Eigen vector state.
 
Basee ()
 Accessor for the internal Eigen vector state.
 
const Q getSubPart (size_t start, size_t cnt) const
 Extracts a sub part (range) of this Q. 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) const
 Convert to a standard vector. More...
 
std::vector< double > toStdVector () const
 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 friend Q operator* (double s, const Q &v)
 Scalar multiplication.
 
const friend 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)
 
template<class Archive >
void serialize (Archive &archive, rw::math::Q &q, const unsigned int version)
 Boost serialization. More...
 
template<class Archive >
void save (Archive &archive, const rw::math::Q &q, const unsigned int version)
 Boost serialization. More...
 
template<class Archive >
void load (Archive &archive, rw::math::Q &q, const unsigned int version)
 Boost serialization. More...
 

Detailed Description

Configuration vector.

Constructor & Destructor Documentation

◆ Q() [1/14]

Q ( )
inline

Default constructor.

The vector will be of dimension zero.

◆ Q() [2/14]

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() [3/14]

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() [4/14]

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() [5/14]

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)
a2[in] Values to initialize q(2)

◆ Q() [6/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)

◆ Q() [7/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)

◆ Q() [8/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)
a5[in] Values to initialize q(5)

◆ Q() [9/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)
a5[in] Values to initialize q(5)
a6[in] Values to initialize q(6)

◆ Q() [10/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)
a5[in] Values to initialize q(5)
a6[in] Values to initialize q(6)
a7[in] Values to initialize q(7)

◆ Q() [11/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)
a5[in] Values to initialize q(5)
a6[in] Values to initialize q(6)
a7[in] Values to initialize q(7)
a8[in] Values to initialize q(8)

◆ Q() [12/14]

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)
a2[in] Values to initialize q(2)
a3[in] Values to initialize q(3)
a4[in] Values to initialize q(4)
a5[in] Values to initialize q(5)
a6[in] Values to initialize q(6)
a7[in] Values to initialize q(7)
a8[in] Values to initialize q(8)
a9[in] Values to initialize q(9)

◆ Q() [13/14]

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() [14/14]

Q ( const Base q)
inline

Construct from Eigen base.

Parameters
q[in] Eigen base.

Member Function Documentation

◆ getSubPart()

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

Extracts a sub part (range) of this Q.

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

◆ norm1()

double norm1 ( ) const
inline

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

Returns
the norm

◆ norm2()

double norm2 ( ) const
inline

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

Returns
the norm

◆ normInf()

double normInf ( ) const
inline

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

Returns
the norm

◆ operator()() [1/2]

double& 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 double& 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 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.

◆ operator[]() [1/2]

double& 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 double& 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 Q part 
)
inline

Set subpart of vector.

Parameters
index[in] the initial index.
part[in] the part to insert beginning from index.

◆ toStdVector() [1/2]

std::vector<double> toStdVector ( ) const
inline

Convert to a standard vector.

Returns
the result.

◆ toStdVector() [2/2]

void toStdVector ( std::vector< double > &  v) const
inline

Convert to a standard vector.

Parameters
v[out] the result.

Friends And Related Function Documentation

◆ load()

void load ( Archive &  archive,
rw::math::Q q,
const unsigned int  version 
)
related

Boost serialization.

Parameters
archive[in] the boost archive to read from.
q[out] the vector to read.
version[in] class version (currently version 0).

◆ operator==()

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.

◆ operator>>()

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

◆ read()

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.

◆ save()

void save ( Archive &  archive,
const rw::math::Q q,
const unsigned int  version 
)
related

Boost serialization.

Parameters
archive[in] the boost archive to write to.
q[in] the vector to write.
version[in] class version (currently version 0).

◆ serialize()

void serialize ( Archive &  archive,
rw::math::Q q,
const unsigned int  version 
)
related

Boost serialization.

Parameters
archive[in] the boost archive to read from or write to.
q[in/out] the vector to read/write.
version[in] class version (currently version 0).

◆ write()

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: