RobWorkProject  23.9.11-
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 (const Q &q)
 
 Q ()
 Default constructor. More...
 
 Q (const std::vector< double > &r)
 Construct a configuration vector from a std::vector expression. More...
 
template<typename... ARGS>
 Q (size_t n, ARGS... args)
 Creates a Q initialized with values from values. More...
 
template<typename... ARGS>
 Q (int n, ARGS... args)
 Creates a Q initialized with values from values. More...
 
template<typename... ARGS>
 Q (double arg0, ARGS... args)
 Creates a Q initialized with values from values. 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.
 
bool operator== (const Q &q2) const
 Compares this and q2 for equality. More...
 
bool operator!= (const Q &q2) const
 Inequality operator The inverse of operator==().
 
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...
 
template<>
 Q (size_t n, 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. More...
 
template<>
 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. More...
 
template<>
 Q (int n, 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. More...
 
template<>
 Q (int 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. More...
 
template<>
 Q (int n, double values)
 Creates a Q of length n and initialize all values in Q to value. More...
 
template<>
 Q (size_t n, double values)
 Creates a Q of length n and initialize all values in Q to value. 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.)

std::ostream & operator<< (std::ostream &out, const Q &v)
 Streaming operator.
 
template<class T >
std::ostream & operator<< (std::ostream &out, const Pose6D< T > &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/12]

Q ( )
inline

Default constructor.

The vector will be of dimension zero.

◆ Q() [2/12]

Q ( const std::vector< double > &  r)

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

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

◆ Q() [3/12]

Q ( size_t  n,
ARGS...  args 
)
inlineexplicit

Creates a Q initialized with values from values.

Parameters
n[in] this value describes the length of the conficuration. This behavior is depreacted. if RW_Q_USE_NEW_CONSTRUCTOR is not defined an exception is thrown if the number of extra arguments doesn't match the value. if RW_Q_USE_NEW_CONSTRUCTOR is defined n is counted as a value unless it matches the extra number of arguments.
args[in] the values of the configuration
Deprecated:
the use of n to describe length is deprecated.

◆ Q() [4/12]

Q ( int  n,
ARGS...  args 
)
inlineexplicit

Creates a Q initialized with values from values.

Parameters
n[in] this value describes the length of the conficuration. This behavior is depreacted. if RW_Q_USE_NEW_CONSTRUCTOR is not defined an exception is thrown if the number of extra arguments doesn't match the value. if RW_Q_USE_NEW_CONSTRUCTOR is defined n is counted as a value unless it matches the extra number of arguments.
args[in] the values of the configuration
Deprecated:
the use of n to describe length is deprecated.

◆ Q() [5/12]

Q ( double  arg0,
ARGS...  args 
)
inlineexplicit

Creates a Q initialized with values from values.

Parameters
arg0[in] first value
args[in] the values of the configuration

◆ Q() [6/12]

Q ( const Base q)
inline

Construct from Eigen base.

Parameters
q[in] Eigen base.

◆ Q() [7/12]

Q ( size_t  n,
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() [8/12]

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

Q ( int  n,
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() [10/12]

Q ( int  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() [11/12]

Q ( int  n,
double  values 
)

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

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

◆ Q() [12/12]

Q ( size_t  n,
double  values 
)

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

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

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==()

bool operator== ( const Q q2) const

Compares this and q2 for equality.

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

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

◆ 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>>()

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: