PCL
pcl::GenericMultiVector< T > Class Template Reference

Generic array of vectors. More...

#include <MultiVector.h>

+ Inheritance diagram for pcl::GenericMultiVector< T >:

Public Types

typedef vector::component component
 
typedef multivector_implementation::const_iterator const_iterator
 
typedef vector::const_iterator const_vector_iterator
 
typedef multivector_implementation::iterator iterator
 
typedef Array< GenericVector< T > > multivector_implementation
 
typedef vector::scalar scalar
 
typedef GenericVector< T > vector
 
typedef vector::iterator vector_iterator
 
- Public Types inherited from pcl::Array< GenericVector< T > >
typedef pcl::Allocator< GenericVector< T >, StandardAllocatorallocator
 
typedef StandardAllocator block_allocator
 
typedef const GenericVector< T > * const_iterator
 
typedef ReverseRandomAccessIterator< const_iterator, const GenericVector< T > > const_reverse_iterator
 
typedef GenericVector< T > * iterator
 
typedef ReverseRandomAccessIterator< iterator, GenericVector< T > > reverse_iterator
 

Public Member Functions

 GenericMultiVector ()=default
 
 GenericMultiVector (size_type length)
 
 GenericMultiVector (size_type length, int vectorLength)
 
 GenericMultiVector (const scalar &value, size_type length, int vectorLength)
 
 GenericMultiVector (const vector &v0, const vector &v1)
 
 GenericMultiVector (const vector &v0, const vector &v1, const vector &v2)
 
 GenericMultiVector (const vector &v0, const vector &v1, const vector &v2, const vector &v3)
 
 GenericMultiVector (const GenericMultiVector &)=default
 
 GenericMultiVector (GenericMultiVector &&)=default
 
 ~GenericMultiVector ()
 
component MaxComponent () const
 
component MinComponent () const
 
GenericMultiVectoroperator*= (const scalar &x)
 
GenericMultiVectoroperator+= (const scalar &x)
 
GenericMultiVectoroperator-= (const scalar &x)
 
GenericMultiVectoroperator/= (const scalar &x)
 
GenericMultiVectoroperator= (const GenericMultiVector &)=default
 
GenericMultiVectoroperator= (GenericMultiVector &&)=default
 
GenericMultiVectoroperator= (const scalar &x)
 
double StableSum () const
 
double Sum () const
 
- Public Member Functions inherited from pcl::Array< GenericVector< T > >
 Array ()
 
 Array (size_type n)
 
 Array (size_type n, const GenericVector< T > &v)
 
 Array (FI i, FI j)
 
 Array (std::initializer_list< T1 > l)
 
 Array (const Array &x)
 
 Array (Array &&x)
 
 ~Array ()
 
void Add (const Array &x)
 
void Add (const GenericVector< T > &v, size_type n=1)
 
void Add (FI p, FI q)
 
void Append (const Array &x)
 
void Append (const GenericVector< T > &v, size_type n=1)
 
void Append (FI p, FI q)
 
void Apply (F f)
 
void Apply (F f) const
 
void Assign (const Array &x)
 
void Assign (const GenericVector< T > &v, size_type n=1)
 
void Assign (FI i, FI j)
 
iterator At (size_type i)
 
const_iterator At (size_type i) const
 
size_type Available () const
 
iterator Begin ()
 
const_iterator Begin () const
 
iterator begin ()
 
const_iterator begin () const
 
size_type Capacity () const
 
void Clear ()
 
const_iterator ConstBegin () const
 
const_iterator ConstEnd () const
 
const_reverse_iterator ConstReverseBegin () const
 
const_reverse_iterator ConstReverseEnd () const
 
bool Contains (const GenericVector< T > &v) const
 
bool Contains (const GenericVector< T > &v, BP p) const
 
iterator ContainsSubset (FI i, FI j) const
 
iterator ContainsSubset (FI i, FI j, BP p) const
 
iterator ContainsSubset (const C &c) const
 
iterator ContainsSubset (const C &c, BP p) const
 
size_type Count (const GenericVector< T > &v) const
 
size_type Count (const GenericVector< T > &v, BP p) const
 
size_type CountIf (UP p) const
 
iterator End ()
 
const_iterator End () const
 
iterator end ()
 
const_iterator end () const
 
void EnsureUnique ()
 
iterator Expand (size_type n=1)
 
void Fill (const GenericVector< T > &v)
 
iterator FirstThat (F f) const
 
const allocatorGetAllocator () const
 
iterator Grow (iterator i, size_type n=1)
 
uint64 Hash (uint64 seed=0) const
 
uint32 Hash32 (uint32 seed=0) const
 
uint64 Hash64 (uint64 seed=0) const
 
void Import (iterator i, iterator j)
 
iterator Insert (iterator i, const Array &x)
 
iterator Insert (iterator i, const GenericVector< T > &v, size_type n=1)
 
iterator Insert (iterator i, FI p, FI q)
 
bool IsAliasOf (const Array &x) const
 
bool IsEmpty () const
 
bool IsUnique () const
 
bool IsValid () const
 
iterator LastThat (F f) const
 
size_type Length () const
 
size_type LowerBound () const
 
iterator MaxItem () const
 
iterator MaxItem (BP p) const
 
iterator MinItem () const
 
iterator MinItem (BP p) const
 
iterator MutableIterator (const_iterator i)
 
GenericVector< T > & operator* ()
 
const GenericVector< T > & operator* () const
 
Arrayoperator= (const Array &x)
 
Arrayoperator= (Array &&x)
 
GenericVector< T > & operator[] (size_type i)
 
const GenericVector< T > & operator[] (size_type i) const
 
void Prepend (const Array &x)
 
void Prepend (const GenericVector< T > &v, size_type n=1)
 
void Prepend (FI p, FI q)
 
iterator Release ()
 
void Remove (iterator i, size_type n=1)
 
void Remove (iterator i, iterator j)
 
void Remove (const GenericVector< T > &v)
 
void Remove (const GenericVector< T > &v, BP p)
 
iterator Replace (iterator i, iterator j, const Array &x)
 
iterator Replace (iterator i, iterator j, const GenericVector< T > &v, size_type n=1)
 
iterator Replace (iterator i, iterator j, FI p, FI q)
 
void Reserve (size_type n)
 
void Resize (size_type n)
 
void Reverse ()
 
reverse_iterator ReverseBegin ()
 
const_reverse_iterator ReverseBegin () const
 
reverse_iterator ReverseEnd ()
 
const_reverse_iterator ReverseEnd () const
 
void Rotate (distance_type n)
 
iterator Search (const GenericVector< T > &v) const
 
iterator Search (const GenericVector< T > &v, BP p) const
 
iterator SearchLast (const GenericVector< T > &v) const
 
iterator SearchLast (const GenericVector< T > &v, BP p) const
 
iterator SearchLastSubset (BI i, BI j) const
 
iterator SearchLastSubset (BI i, BI j, BP p) const
 
iterator SearchLastSubset (const C &x) const
 
iterator SearchLastSubset (const C &x, BP p) const
 
iterator SearchSubset (FI i, FI j) const
 
iterator SearchSubset (FI i, FI j, BP p) const
 
iterator SearchSubset (const C &x) const
 
iterator SearchSubset (const C &x, BP p) const
 
void SecureFill (const GenericVector< T > &v)
 
void SetAllocator (const allocator &a)
 
void ShiftLeft (const GenericVector< T > &v, size_type n=1)
 
void ShiftRight (const GenericVector< T > &v, size_type n=1)
 
void Shrink (size_type n=1)
 
size_type Size () const
 
void Sort ()
 
void Sort (BP p)
 
void Squeeze ()
 
S & ToCommaSeparated (S &s) const
 
S & ToSeparated (S &s, SP separator) const
 
S & ToSeparated (S &s, SP separator, AF append) const
 
S & ToSpaceSeparated (S &s) const
 
S & ToTabSeparated (S &s) const
 
void Transfer (Array &x)
 
void Transfer (Array &&x)
 
void Truncate (iterator i)
 
void UniquifyIterator (iterator &i)
 
void UniquifyIterators (iterator &i, iterator &j)
 
size_type UpperBound () const
 

Detailed Description

template<typename T>
class pcl::GenericMultiVector< T >

A multivector is a dynamic array of vectors. It can also be seen as a vector of vectors, or a vector whose components are also vectors. GenericMultiVector implements a homogeneous multivector based on the Array and GenericVector template classes. Besides all the member functions inherited from its base class, it also provides some useful constructors and assignment operators, including arithmetic scalar-to-vector operators that work on all the contained vectors as a whole.

Some typical applications of multivectors include:

  • Implementation of more sophisticated mathematical objects and structures, such as tensors.
  • Matrices where rows (or equivalently, columns) have to be manipulated as independent structures. For example, to swap two rows of a GenericMatrix you have to swap each pair of row elements successively, which is an O(N) operation. Swapping two component vectors of a multivector is an O(1) operation thanks to the implicit data sharing feature of GenericVector, and hence does not require copying or duplicating data.
  • Arrays and matrices where each component is a vector of variable length.

As most PCL containers, GenericMultiVector is a reference-counted class with implicit data sharing (or copy-on-write) functionality.

See also
Array, GenericVector, GenericMatrix

Definition at line 100 of file MultiVector.h.

Member Typedef Documentation

◆ component

template<typename T>
typedef vector::component pcl::GenericMultiVector< T >::component

Represents a vector component.

Definition at line 122 of file MultiVector.h.

◆ const_iterator

Represents an immutable multivector iterator.

Definition at line 134 of file MultiVector.h.

◆ const_vector_iterator

Represents an immutable vector iterator.

Definition at line 144 of file MultiVector.h.

◆ iterator

Represents a mutable multivector iterator.

Definition at line 128 of file MultiVector.h.

◆ multivector_implementation

template<typename T>
typedef Array<GenericVector<T> > pcl::GenericMultiVector< T >::multivector_implementation

The structure implementing this multivector class.

Definition at line 107 of file MultiVector.h.

◆ scalar

template<typename T>
typedef vector::scalar pcl::GenericMultiVector< T >::scalar

Represents a scalar.

Definition at line 117 of file MultiVector.h.

◆ vector

template<typename T>
typedef GenericVector<T> pcl::GenericMultiVector< T >::vector

Represents a vector.

Definition at line 112 of file MultiVector.h.

◆ vector_iterator

template<typename T>
typedef vector::iterator pcl::GenericMultiVector< T >::vector_iterator

Represents a mutable vector iterator.

Definition at line 139 of file MultiVector.h.

Constructor & Destructor Documentation

◆ GenericMultiVector() [1/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( )
default

Constructs an empty multivector. An empty multivector has no component vectors and zero length.

◆ GenericMultiVector() [2/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( size_type  length)
inline

Constructs an uninitialized multivector of the specified length.

This constructor does not initialize component vectors. The newly created multivector will contain length empty vectors.

Definition at line 158 of file MultiVector.h.

◆ GenericMultiVector() [3/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( size_type  length,
int  vectorLength 
)
inline

Constructs a multivector with uninitialized component vectors.

Parameters
lengthNumber of multivector components.
vectorLengthNumber of vector components (>= 0).

This constructor does not initialize vector components. The newly created vectors will contain unpredictable values.

Definition at line 173 of file MultiVector.h.

◆ GenericMultiVector() [4/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( const scalar value,
size_type  length,
int  vectorLength 
)
inline

Constructs a multivector and fills it with a constant scalar.

Parameters
valueInitial value for all vector components.
lengthNumber of multivector components.
vectorLengthNumber of vector components (>= 0).

Definition at line 189 of file MultiVector.h.

◆ GenericMultiVector() [5/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( const vector v0,
const vector v1 
)
inline

Constructs a multivector of two components initialized with copies of the specified vectors v0 and v1, respectively for the first and second component vectors.

Definition at line 201 of file MultiVector.h.

◆ GenericMultiVector() [6/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( const vector v0,
const vector v1,
const vector v2 
)
inline

Constructs a multivector of three components initialized with copies of the specified vectors v0, v1 and v2, respectively for the first, second and third component vectors.

Definition at line 213 of file MultiVector.h.

◆ GenericMultiVector() [7/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( const vector v0,
const vector v1,
const vector v2,
const vector v3 
)
inline

Constructs a multivector of four components initialized with copies of the specified vectors v0, v1, v2 and v3, respectively for the first, second, third and fourth component vectors.

Definition at line 225 of file MultiVector.h.

◆ GenericMultiVector() [8/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( const GenericMultiVector< T > &  )
default

Copy constructor.

◆ GenericMultiVector() [9/9]

template<typename T>
pcl::GenericMultiVector< T >::GenericMultiVector ( GenericMultiVector< T > &&  )
default

Move constructor.

◆ ~GenericMultiVector()

template<typename T>
pcl::GenericMultiVector< T >::~GenericMultiVector ( )
inline

Destroys a GenericMultiVector object.

Definition at line 245 of file MultiVector.h.

Member Function Documentation

◆ MaxComponent()

template<typename T>
component pcl::GenericMultiVector< T >::MaxComponent ( ) const
inline

Returns the value of the largest vector component. For empty multivectors, this function returns zero.

Definition at line 360 of file MultiVector.h.

◆ MinComponent()

template<typename T>
component pcl::GenericMultiVector< T >::MinComponent ( ) const
inline

Returns the value of the smallest vector component. For empty multivectors, this function returns zero.

Definition at line 344 of file MultiVector.h.

◆ operator*=()

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator*= ( const scalar x)
inline

Multiplies all vector components in this multivector by a constant scalar x. Returns a reference to this object.

Definition at line 296 of file MultiVector.h.

◆ operator+=()

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator+= ( const scalar x)
inline

Adds a constant scalar x to all vector components in this multivector. Returns a reference to this object.

Definition at line 274 of file MultiVector.h.

◆ operator-=()

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator-= ( const scalar x)
inline

Subtracts a constant scalar x from all vector components of this multivector. Returns a reference to this object.

Definition at line 285 of file MultiVector.h.

◆ operator/=()

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator/= ( const scalar x)
inline

Divides all vector components in this multivector by a constant scalar x. Returns a reference to this object.

Definition at line 307 of file MultiVector.h.

◆ operator=() [1/3]

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator= ( const GenericMultiVector< T > &  )
default

Copy assignment operator. Returns a reference to this object.

◆ operator=() [2/3]

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator= ( GenericMultiVector< T > &&  )
default

Move assignment operator. Returns a reference to this object.

◆ operator=() [3/3]

template<typename T>
GenericMultiVector& pcl::GenericMultiVector< T >::operator= ( const scalar x)
inline

Assigns a constant scalar x to all vector components in this multivector. Returns a reference to this object.

Definition at line 263 of file MultiVector.h.

◆ StableSum()

template<typename T>
double pcl::GenericMultiVector< T >::StableSum ( ) const
inline

Computes the sum of vector components using a numerically stable summation algorithm to minimize roundoff error.

Definition at line 329 of file MultiVector.h.

◆ Sum()

template<typename T>
double pcl::GenericMultiVector< T >::Sum ( ) const
inline

Returns the sum of all vector components.

Definition at line 317 of file MultiVector.h.


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