PCL
pcl::GenericMultiVector< T > Class Template Reference

Generic array of vectors. More...

#include <MultiVector.h>

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

Public Types

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

Public Member Functions

 GenericMultiVector ()=default
 
 GenericMultiVector (const GenericMultiVector &)=default
 
 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 (GenericMultiVector &&)=default
 
 GenericMultiVector (size_type length)
 
 GenericMultiVector (size_type length, int vectorLength)
 
 ~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= (const scalar &x)
 
GenericMultiVectoroperator= (GenericMultiVector &&)=default
 
double StableSum () const
 
double Sum () const
 
- Public Member Functions inherited from pcl::Array< GenericVector< T > >
 Array ()
 
 Array (Array &&x)
 
 Array (const Array &x)
 
 Array (FI i, FI j)
 
 Array (size_type n)
 
 Array (size_type n, const GenericVector< T > &v)
 
 Array (std::initializer_list< T1 > l)
 
 ~Array ()
 
void Add (const Array &x)
 
void Add (const GenericVector< T > &v, size_type n=1)
 
void Add (FI p, FI q)
 
const allocatorAllocator () const noexcept
 
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 noexcept(noexcept(f))
 
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 noexcept
 
size_type Available () const noexcept
 
iterator Begin ()
 
iterator begin ()
 
const_iterator Begin () const noexcept
 
const_iterator begin () const noexcept
 
size_type Capacity () const noexcept
 
void Clear ()
 
const_iterator ConstBegin () const noexcept
 
const_iterator ConstEnd () const noexcept
 
const_reverse_iterator ConstReverseBegin () const noexcept
 
const_reverse_iterator ConstReverseEnd () const noexcept
 
bool Contains (const GenericVector< T > &v) const noexcept
 
bool Contains (const GenericVector< T > &v, BP p) const noexcept(noexcept(p))
 
iterator ContainsSubset (const C &c) const noexcept
 
iterator ContainsSubset (const C &c, BP p) const noexcept(noexcept(p))
 
iterator ContainsSubset (FI i, FI j) const noexcept
 
iterator ContainsSubset (FI i, FI j, BP p) const noexcept(noexcept(p))
 
size_type Count (const GenericVector< T > &v) const noexcept
 
size_type Count (const GenericVector< T > &v, BP p) const noexcept(noexcept(p))
 
size_type CountIf (UP p) const noexcept(noexcept(p))
 
iterator End ()
 
iterator end ()
 
const_iterator End () const noexcept
 
const_iterator end () const noexcept
 
void EnsureUnique ()
 
iterator Expand (size_type n=1)
 
void Fill (const GenericVector< T > &v)
 
iterator FirstThat (F f)
 
const_iterator FirstThat (F f) const noexcept(noexcept(f))
 
iterator Grow (iterator i, size_type n=1)
 
uint64 Hash (uint64 seed=0) const noexcept
 
uint32 Hash32 (uint32 seed=0) const noexcept
 
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 noexcept
 
bool IsEmpty () const noexcept
 
bool IsUnique () const noexcept
 
bool IsValid () const noexcept
 
const_iterator LastThat (F f) const noexcept(noexcept(f))
 
size_type Length () const noexcept
 
size_type LowerBound () const noexcept
 
iterator MaxItem ()
 
const_iterator MaxItem () const noexcept
 
iterator MaxItem (BP p)
 
const_iterator MaxItem (BP p) const noexcept(noexcept(p))
 
iterator MinItem ()
 
const_iterator MinItem () const noexcept
 
iterator MinItem (BP p)
 
const_iterator MinItem (BP p) const noexcept(noexcept(p))
 
iterator MutableIterator (const_iterator i)
 
GenericVector< T > & operator* ()
 
const GenericVector< T > & operator* () const noexcept
 
Arrayoperator= (Array &&x)
 
Arrayoperator= (const Array &x)
 
GenericVector< T > & operator[] (size_type i)
 
const GenericVector< T > & operator[] (size_type i) const noexcept
 
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 (const GenericVector< T > &v)
 
void Remove (const GenericVector< T > &v, BP p)
 
void Remove (iterator i, iterator j)
 
void Remove (iterator i, size_type n=1)
 
void RemoveFirst (size_type n=1)
 
void RemoveLast (size_type n=1)
 
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 noexcept
 
reverse_iterator ReverseEnd ()
 
const_reverse_iterator ReverseEnd () const noexcept
 
void Rotate (distance_type n)
 
iterator Search (const GenericVector< T > &v)
 
const_iterator Search (const GenericVector< T > &v) const noexcept
 
iterator Search (const GenericVector< T > &v, BP p)
 
const_iterator Search (const GenericVector< T > &v, BP p) const noexcept(noexcept(p))
 
iterator SearchLast (const GenericVector< T > &v)
 
const_iterator SearchLast (const GenericVector< T > &v) const noexcept
 
iterator SearchLast (const GenericVector< T > &v, BP p)
 
const_iterator SearchLast (const GenericVector< T > &v, BP p) const noexcept(noexcept(p))
 
iterator SearchLastSubset (BI i, BI j)
 
const_iterator SearchLastSubset (BI i, BI j) const noexcept
 
iterator SearchLastSubset (BI i, BI j, BP p)
 
const_iterator SearchLastSubset (BI i, BI j, BP p) const noexcept(noexcept(p))
 
iterator SearchLastSubset (const C &x)
 
const_iterator SearchLastSubset (const C &x) const noexcept
 
iterator SearchLastSubset (const C &x, BP p)
 
const_iterator SearchLastSubset (const C &x, BP p) const noexcept(noexcept(p))
 
iterator SearchSubset (const C &x)
 
const_iterator SearchSubset (const C &x) const noexcept
 
iterator SearchSubset (const C &x, BP p)
 
const_iterator SearchSubset (const C &x, BP p) const noexcept(noexcept(p))
 
iterator SearchSubset (FI i, FI j)
 
const_iterator SearchSubset (FI i, FI j) const noexcept
 
iterator SearchSubset (FI i, FI j, BP p)
 
const_iterator SearchSubset (FI i, FI j, BP p) const noexcept(noexcept(p))
 
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 noexcept
 
void Sort ()
 
void Sort (BP p)
 
void Squeeze ()
 
S & ToCommaSeparated (S &s) const
 
S & ToNewLineSeparated (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 noexcept
 

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 >
using pcl::GenericMultiVector< T >::component = typename vector::component

Represents a vector component.

Definition at line 122 of file MultiVector.h.

◆ const_iterator

Represents an immutable multivector iterator.

Definition at line 132 of file MultiVector.h.

◆ const_vector_iterator

template<typename T >
using pcl::GenericMultiVector< T >::const_vector_iterator = typename vector::const_iterator

Represents an immutable vector iterator.

Definition at line 142 of file MultiVector.h.

◆ iterator

template<typename T >
using pcl::GenericMultiVector< T >::iterator = typename multivector_implementation::iterator

Represents a mutable multivector iterator.

Definition at line 127 of file MultiVector.h.

◆ multivector_implementation

template<typename T >
using pcl::GenericMultiVector< T >::multivector_implementation = Array<GenericVector<T> >

The structure implementing this multivector class.

Definition at line 107 of file MultiVector.h.

◆ scalar

template<typename T >
using pcl::GenericMultiVector< T >::scalar = typename vector::scalar

Represents a scalar.

Definition at line 117 of file MultiVector.h.

◆ vector

template<typename T >
using pcl::GenericMultiVector< T >::vector = GenericVector<T>

Represents a vector.

Definition at line 112 of file MultiVector.h.

◆ vector_iterator

template<typename T >
using pcl::GenericMultiVector< T >::vector_iterator = typename vector::iterator

Represents a mutable vector iterator.

Definition at line 137 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 156 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 171 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 187 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 199 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 211 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 223 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 243 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 358 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 342 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 294 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 272 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 283 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 305 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= ( 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 261 of file MultiVector.h.

◆ operator=() [3/3]

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

Move assignment operator. Returns a reference to this object.

◆ 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 327 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 315 of file MultiVector.h.


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