PCL
pcl::GenericVector< T > Class Template Reference

Generic vector of arbitrary length. More...

#include <Vector.h>

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

Public Types

typedef T component
 
typedef const T * const_iterator
 
typedef T * iterator
 
typedef T scalar
 

Public Member Functions

 GenericVector ()
 
 GenericVector (int len)
 
 GenericVector (const component &x, int len)
 
template<typename T1 >
 GenericVector (const T1 *a, int len)
 
template<typename T1 >
 GenericVector (std::initializer_list< T1 > c)
 
template<typename T1 >
 GenericVector (const T1 &x, const T1 &y, const T1 &z)
 
template<typename T1 >
 GenericVector (const T1 &x, const T1 &y, const T1 &z, const T1 &t)
 
 GenericVector (const GenericVector &x)
 
 GenericVector (GenericVector &&x)
 
virtual ~GenericVector ()
 
GenericVector Abs () const
 
void Assign (const GenericVector &x)
 
iterator At (int i)
 
const_iterator At (int i) const
 
double AvgDev (double center) const
 
double AvgDev () const
 
iterator Begin ()
 
const_iterator Begin () const
 
iterator begin ()
 
const_iterator begin () const
 
double BendMidvariance (double center, double beta=0.2) const
 
double BendMidvariance (double beta=0.2) const
 
double BiweightMidvariance (double center, double sigma, int k=9) const
 
double BiweightMidvariance (int k=9) const
 
void Clear ()
 
iterator ComponentPtr (int i)
 
const_iterator ConstBegin () const
 
const_iterator ConstEnd () const
 
bool Contains (const component &x) const
 
iterator DataPtr ()
 
iterator End ()
 
const_iterator End () const
 
iterator end ()
 
const_iterator end () const
 
void EnsureUnique ()
 
int Find (const component &x) const
 
int FindFirst (const component &x) const
 
int FindLast (const component &x) const
 
uint64 Hash (uint64 seed=0) const
 
uint32 Hash32 (uint32 seed=0) const
 
uint64 Hash64 (uint64 seed=0) const
 
int IndexOfLargestComponent () const
 
int IndexOfLastLargestComponent () const
 
int IndexOfLastSmallestComponent () const
 
int IndexOfLastSmallestNonzeroComponent () const
 
int IndexOfSmallestComponent () const
 
int IndexOfSmallestNonzeroComponent () const
 
bool IsAliasOf (const GenericVector &x) const
 
bool IsEmpty () const
 
bool IsUnique () const
 
bool IsValid () const
 
double L1Norm () const
 
double L2Norm () const
 
int Length () const
 
double MAD (double center) const
 
double MAD () const
 
component MaxComponent () const
 
double Mean () const
 
double Median ()
 
double Median () const
 
component MinComponent () const
 
double Modulus () const
 
double Norm (double p) const
 
double Norm () const
 
 operator bool () const
 
iterator operator* ()
 
const_iterator operator* () const
 
GenericVectoroperator*= (const GenericVector &x)
 
GenericVectoroperator*= (const scalar &x)
 
GenericVectoroperator+= (const GenericVector &x)
 
GenericVectoroperator+= (const scalar &x)
 
GenericVectoroperator-= (const GenericVector &x)
 
GenericVectoroperator-= (const scalar &x)
 
GenericVectoroperator/= (const GenericVector &x)
 
GenericVectoroperator/= (const scalar &x)
 
bool operator< (const GenericVector &x) const
 
GenericVectoroperator= (const GenericVector &x)
 
GenericVectoroperator= (GenericVector &&x)
 
GenericVectoroperator= (const scalar &x)
 
bool operator== (const GenericVector &x) const
 
componentoperator[] (int i)
 
const componentoperator[] (int i) const
 
GenericVectoroperator^= (const scalar &x)
 
component OrderStatistic (int k)
 
component OrderStatistic (int k) const
 
double Qn () const
 
void ReverseSort ()
 
GenericVector ReverseSorted () const
 
bool SameLength (const GenericVector &x) const
 
void SetAbs ()
 
void SetSqr ()
 
void SetSqrt ()
 
void SetUnit ()
 
size_type Size () const
 
double Sn () const
 
void Sort ()
 
template<class BP >
void Sort (BP p)
 
GenericVector Sorted () const
 
template<class BP >
GenericVector Sorted (BP p) const
 
GenericVector Sqr () const
 
GenericVector Sqrt () const
 
double StableAvgDev (double center) const
 
double StableAvgDev () const
 
double StableMean () const
 
double StableModulus () const
 
double StableSum () const
 
double StableSumOfSquares () const
 
double StdDev () const
 
double Sum () const
 
double SumOfSquares () const
 
template<class S >
S & ToCommaSeparated (S &s) const
 
template<class S , typename SP >
S & ToSeparated (S &s, SP separator) const
 
template<class S , typename SP , class AF >
S & ToSeparated (S &s, SP separator, AF append) const
 
template<class S >
S & ToSpaceSeparated (S &s) const
 
template<typename T1 , typename T2 >
void ToSpherical (T1 &lon, T2 &lat) const
 
template<typename T1 , typename T2 >
void ToSpherical2Pi (T1 &lon, T2 &lat) const
 
template<class S >
S & ToTabSeparated (S &s) const
 
void Transfer (GenericVector &x)
 
void Transfer (GenericVector &&x)
 
GenericVector Unit () const
 
double Variance () const
 

Static Public Member Functions

static GenericVector FromSpherical (double slon, double clon, double slat, double clat)
 
template<typename T1 , typename T2 >
static GenericVector FromSpherical (const T1 &lon, const T2 &lat)
 

Friends

void Swap (GenericVector &x1, GenericVector &x2)
 

Detailed Description

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

GenericVector is a lightweight template class implementing a vector of arbitrary length. This class provides the following main features:

  • Implicit data sharing with reference counting and copy-on-write functionality. GenericVector instances can safely be passed as function return values and by-value function arguments.
  • Thread-safe. GenericVector instances can safely be accessed from multiple threads. The reference counter implements atomic reference and dereference operations.
  • Efficient vector storage and access to vector elements. Vector elements are allocated as a single, contiguous memory block.
  • Support for a large set of vector operations, including scalar-to-vector and vector-to-vector arithmetic operations, dot and cross products.
  • Calculation of a variety of descriptive statistics of vector components.
See also
GenericMatrix, Vector Operators, Vector Types

Definition at line 106 of file Vector.h.

Member Typedef Documentation

◆ component

template<typename T>
typedef T pcl::GenericVector< T >::component

Represents a vector component.

Definition at line 118 of file Vector.h.

◆ const_iterator

template<typename T>
typedef const T* pcl::GenericVector< T >::const_iterator

Represents an immutable vector iterator.

Definition at line 128 of file Vector.h.

◆ iterator

template<typename T>
typedef T* pcl::GenericVector< T >::iterator

Represents a mutable vector iterator.

Definition at line 123 of file Vector.h.

◆ scalar

template<typename T>
typedef T pcl::GenericVector< T >::scalar

Represents a scalar.

Definition at line 113 of file Vector.h.

Constructor & Destructor Documentation

◆ GenericVector() [1/9]

template<typename T>
pcl::GenericVector< T >::GenericVector ( )
inline

Constructs an empty vector. An empty vector has no components and its length is zero.

Definition at line 134 of file Vector.h.

◆ GenericVector() [2/9]

template<typename T>
pcl::GenericVector< T >::GenericVector ( int  len)
inline

Constructs an uninitialized vector of the specified length.

Parameters
lenNumber of vector components (>= 0).

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

Definition at line 147 of file Vector.h.

◆ GenericVector() [3/9]

template<typename T>
pcl::GenericVector< T >::GenericVector ( const component x,
int  len 
)
inline

Constructs a vector and fills it with a constant component value.

Parameters
xInitial value for all vector components.
lenNumber of vector components (>= 0).

Definition at line 158 of file Vector.h.

◆ GenericVector() [4/9]

template<typename T>
template<typename T1 >
pcl::GenericVector< T >::GenericVector ( const T1 *  a,
int  len 
)
inline

Constructs a vector and initializes it with component values taken from a static array.

Parameters
aAddress of the first item of a static array for initialization of vector components. The array must provide at least len consecutive items.
lenNumber of vector components (>= 0).

Definition at line 176 of file Vector.h.

◆ GenericVector() [5/9]

template<typename T>
template<typename T1 >
pcl::GenericVector< T >::GenericVector ( std::initializer_list< T1 >  c)
inline

Constructs a vector and initializes it with component values taken from the specified initializer list c.

This constructor is equivalent to:

GenericVector( c.begin(), int( c.size() ) )

Definition at line 193 of file Vector.h.

◆ GenericVector() [6/9]

template<typename T>
template<typename T1 >
pcl::GenericVector< T >::GenericVector ( const T1 &  x,
const T1 &  y,
const T1 &  z 
)
inline

Constructs a three-component vector initialized with the specified x, y and z component values.

Definition at line 202 of file Vector.h.

◆ GenericVector() [7/9]

template<typename T>
template<typename T1 >
pcl::GenericVector< T >::GenericVector ( const T1 &  x,
const T1 &  y,
const T1 &  z,
const T1 &  t 
)
inline

Constructs a four-component vector initialized with the specified x, y, z and t component values.

Definition at line 216 of file Vector.h.

◆ GenericVector() [8/9]

template<typename T>
pcl::GenericVector< T >::GenericVector ( const GenericVector< T > &  x)
inline

Copy constructor. This object references the same data that is being referenced by the specified vector x.

Definition at line 230 of file Vector.h.

◆ GenericVector() [9/9]

template<typename T>
pcl::GenericVector< T >::GenericVector ( GenericVector< T > &&  x)
inline

Move constructor.

Definition at line 238 of file Vector.h.

◆ ~GenericVector()

template<typename T>
virtual pcl::GenericVector< T >::~GenericVector ( )
inlinevirtual

Destroys a GenericVector object. This destructor dereferences the vector data. If the vector data becomes unreferenced, it is destroyed and deallocated immediately.

Definition at line 248 of file Vector.h.

Member Function Documentation

◆ Abs()

template<typename T>
GenericVector pcl::GenericVector< T >::Abs ( ) const
inline

Returns the absolute value of this vector. The result is a new vector of the same length where each component is the absolute value of its counterpart in this vector.

Definition at line 660 of file Vector.h.

◆ Assign()

template<typename T>
void pcl::GenericVector< T >::Assign ( const GenericVector< T > &  x)
inline

Assigns a vector x to this object.

If this instance and the specified source instance x reference different vector data, the data previously referenced by this object is dereferenced. If the previous data becomes unreferenced, it is destroyed and deallocated. Then the data being referenced by x is also referenced by this object.

If this instance and the specified source instance x already reference the same vector data, then this function does nothing.

Definition at line 296 of file Vector.h.

◆ At() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::At ( int  i)
inline

Returns a mutable vector iterator pointing to the i-th component of this vector.

Before returning, this function ensures that this instance uniquely references its vector data.

Definition at line 1593 of file Vector.h.

◆ At() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::At ( int  i) const
inline

Returns an immutable vector iterator pointing to the i-th component of this vector.

Definition at line 1603 of file Vector.h.

◆ AvgDev() [1/2]

template<typename T>
double pcl::GenericVector< T >::AvgDev ( double  center) const
inline

Returns the average absolute deviation with respect to the specified center value.

When the median of the vector elements is used as the center value, this function returns the average absolute deviation from the median, which is a well-known estimator of dispersion.

For vectors with less than two components, this function returns zero.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 1175 of file Vector.h.

◆ AvgDev() [2/2]

template<typename T>
double pcl::GenericVector< T >::AvgDev ( ) const
inline

Returns the average absolute deviation from the median.

The mean absolute deviation from the median is a well-known estimator of dispersion.

For vectors with less than two components, this function returns zero.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 1212 of file Vector.h.

◆ Begin() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::Begin ( )
inline

Returns a mutable vector iterator pointing to the first vector component, i.e. to the component at index 0 of this vector.

All vector components are guaranteed to be stored at consecutive locations addressable from the iterator returned by this function.

Before returning, this function ensures that this instance uniquely references its vector data.

Definition at line 1618 of file Vector.h.

Referenced by pcl::GenericVector< sample *>::operator==(), pcl::GenericVector< sample *>::Qn(), and pcl::GenericVector< sample *>::Sn().

◆ Begin() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::Begin ( ) const
inline

Returns an immutable vector iterator pointing to the first vector component, i.e. to the component at index 0 of this vector.

All vector components are guaranteed to be stored at consecutive locations addressable from the iterator returned by this function.

Definition at line 1631 of file Vector.h.

◆ begin() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::begin ( )
inline

STL-compatible iteration. Equivalent to Begin().

Definition at line 1767 of file Vector.h.

◆ begin() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::begin ( ) const
inline

STL-compatible iteration. Equivalent to Begin() const.

Definition at line 1775 of file Vector.h.

◆ BendMidvariance() [1/2]

template<typename T>
double pcl::GenericVector< T >::BendMidvariance ( double  center,
double  beta = 0.2 
) const
inline

Returns a percentage bend midvariance (PBMV).

Parameters
centerReference center value. Normally, the median of the vector components should be used.
betaRejection parameter in the [0,0.5] range. Higher values improve robustness to outliers (i.e., increase the breakdown point of the estimator) at the expense of lower efficiency. The default value is beta=0.2.

The square root of the percentage bend midvariance is a robust estimator of scale. With the default beta=0.2, its Gaussian efficiency is 67%. With beta=0.1, its efficiency is 85% but its breakdown is only 0.1.

For vectors with less than two components, this function returns zero.

References

Rand R. Wilcox (2012), Introduction to Robust Estimation and Hypothesis Testing, 3rd Edition, Elsevier Inc., Section 3.12.3.

Definition at line 1342 of file Vector.h.

◆ BendMidvariance() [2/2]

template<typename T>
double pcl::GenericVector< T >::BendMidvariance ( double  beta = 0.2) const
inline

Returns a percentage bend midvariance (PBMV) with respect to the median.

Parameters
betaRejection parameter in the [0,0.5] range. Higher values improve robustness to outliers (i.e., increase the breakdown point of the estimator) at the expense of lower efficiency. The default value is beta=0.2.

The square root of the percentage bend midvariance is a robust estimator of scale. With the default beta=0.2, its Gaussian efficiency is 67%. With beta=0.1, its efficiency is 85% but its breakdown is only 0.1.

For vectors with less than two components, this function returns zero.

References

Rand R. Wilcox (2012), Introduction to Robust Estimation and Hypothesis Testing, 3rd Edition, Elsevier Inc., Section 3.12.3.

Definition at line 1366 of file Vector.h.

◆ BiweightMidvariance() [1/2]

template<typename T>
double pcl::GenericVector< T >::BiweightMidvariance ( double  center,
double  sigma,
int  k = 9 
) const
inline

Returns a biweight midvariance (BWMV).

Parameters
centerReference center value. Normally, the median of the vector components should be used.
sigmaA reference estimate of dispersion. Normally, the median absolute deviation from the median (MAD) of the vector components should be used.
kRejection limit in sigma units. The default value is k=9.

The square root of the biweight midvariance is a robust estimator of scale. It is an efficient estimator with respect to many statistical distributions (about 87% Gaussian efficiency), and appears to have a breakdown point close to 0.5 (the same as MAD).

For vectors with less than two components, this function returns zero.

References

Rand R. Wilcox (2012), Introduction to Robust Estimation and Hypothesis Testing, 3rd Edition, Elsevier Inc., Section 3.12.1.

Definition at line 1290 of file Vector.h.

◆ BiweightMidvariance() [2/2]

template<typename T>
double pcl::GenericVector< T >::BiweightMidvariance ( int  k = 9) const
inline

Returns the biweight midvariance (BWMV) with respect to the median and median absolute deviation (MAD).

Parameters
kRejection limit in sigma units. The default value is k=9.

The square root of the biweight midvariance is a robust estimator of scale. It is an efficient estimator with respect to many statistical distributions (about 87% Gaussian efficiency), and appears to have a breakdown point close to 0.5 (the same as MAD).

For vectors with less than two components, this function returns zero.

References

Rand R. Wilcox (2012), Introduction to Robust Estimation and Hypothesis Testing, 3rd Edition, Elsevier Inc., Section 3.12.1.

Definition at line 1313 of file Vector.h.

◆ Clear()

template<typename T>
void pcl::GenericVector< T >::Clear ( )
inline

Deallocates vector data, yielding an empty vector.

Definition at line 260 of file Vector.h.

◆ ComponentPtr()

template<typename T>
iterator pcl::GenericVector< T >::ComponentPtr ( int  i)
inline

Returns a pointer to the ith component in this vector.

All vector components are guaranteed to be stored at consecutive locations addressable from the iterator returned by this function.

This member function does not ensure that the data referenced by this vector is unique. See DataPtr() for more information on how to use this member function.

Definition at line 1758 of file Vector.h.

◆ ConstBegin()

template<typename T>
const_iterator pcl::GenericVector< T >::ConstBegin ( ) const
inline

A synonym for Begin() const.

Definition at line 1639 of file Vector.h.

Referenced by pcl::Array< GenericVector< T > >::Replace().

◆ ConstEnd()

template<typename T>
const_iterator pcl::GenericVector< T >::ConstEnd ( ) const
inline

A synonym for End() const.

Definition at line 1699 of file Vector.h.

◆ Contains()

template<typename T>
bool pcl::GenericVector< T >::Contains ( const component x) const
inline

Returns true iff this vector contains the specified value x.

Definition at line 855 of file Vector.h.

◆ DataPtr()

template<typename T>
iterator pcl::GenericVector< T >::DataPtr ( )
inline

Returns a pointer to the first component in this vector.

The returned pointer can be used as a common C array, where all vector components are guaranteed to be stored consecutively starting from the pointer returned by this function.

This member function does nothing to ensure that this instance uniquely references its vector data. Consequently, the caller must take into account that all modifications made to vector components accessed through the value returned by this function will apply to all instances sharing the same vector data.

This function can be used to perform fast operations on vector components avoiding the overhead caused by deep copies of vector data, when such copies are not necessary. Typically this happens when two or more threads work simultaneously on non-overlapping regions of the same vector.

Definition at line 1743 of file Vector.h.

◆ End() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::End ( )
inline

Returns a mutable iterator past the last vector component, i.e. a pointer to a (nonexistent) component located at index=Length().

All vector components are guaranteed to be stored in reverse order at consecutive locations addressable from the iterator returned by this function.

Before returning, this function ensures that this instance uniquely references its vector data.

Definition at line 1677 of file Vector.h.

Referenced by pcl::GenericVector< sample *>::operator==(), pcl::GenericVector< sample *>::Qn(), and pcl::GenericVector< sample *>::Sn().

◆ End() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::End ( ) const
inline

Returns an immutable iterator past the last vector component, i.e. a pointer to a (nonexistent) component located at index=Length().

All vector components are guaranteed to be stored in reverse order at consecutive locations addressable from the iterator returned by this function.

Definition at line 1691 of file Vector.h.

◆ end() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::end ( )
inline

STL-compatible iteration. Equivalent to End().

Definition at line 1783 of file Vector.h.

◆ end() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::end ( ) const
inline

STL-compatible iteration. Equivalent to End() const.

Definition at line 1791 of file Vector.h.

◆ EnsureUnique()

template<typename T>
void pcl::GenericVector< T >::EnsureUnique ( )
inline

Ensures that this instance uniquely references its vector data.

If necessary, this member function generates a duplicate of the vector data, references it, and then decrements the reference counter of the original vector data.

Definition at line 1485 of file Vector.h.

◆ Find()

template<typename T>
int pcl::GenericVector< T >::Find ( const component x) const
inline

Returns the index of the first vector element with the specified value x, or -1 if this vector does not contain such value.

Definition at line 826 of file Vector.h.

◆ FindFirst()

template<typename T>
int pcl::GenericVector< T >::FindFirst ( const component x) const
inline

Returns the index of the first vector element with the specified value x, or -1 if this vector does not contain such value. This function is an alias to Find().

Definition at line 837 of file Vector.h.

◆ FindLast()

template<typename T>
int pcl::GenericVector< T >::FindLast ( const component x) const
inline

Returns the index of the last vector element with the specified value x, or -1 if this vector does not contain such value.

Definition at line 846 of file Vector.h.

◆ FromSpherical() [1/2]

template<typename T>
static GenericVector pcl::GenericVector< T >::FromSpherical ( double  slon,
double  clon,
double  slat,
double  clat 
)
inlinestatic

Returns a three-component vector with rectangular coordinates computed from spherical coordinates, given by their sines and cosines

Parameters
slonSine of the longitude.
clonCosine of the longitude.
slatSine of the latitude.
clatCosine of the latitude.

The returned vector contains the direction cosines for the specified position on the sphere. It is a unit vector (unit magnitude) pointing from the center of the sphere to the specified location.

See also
ToSpherical(), ToSpherical2Pi()

Definition at line 1861 of file Vector.h.

◆ FromSpherical() [2/2]

template<typename T>
template<typename T1 , typename T2 >
static GenericVector pcl::GenericVector< T >::FromSpherical ( const T1 &  lon,
const T2 &  lat 
)
inlinestatic

Returns a three-component vector with rectangular coordinates computed from the specified spherical coordinates.

Parameters
lonLongitude in radians.
latLatitude in radians.

The returned vector contains the direction cosines for the specified position on the sphere. It is a unit vector (unit magnitude) pointing from the center of the sphere to the specified location.

See also
ToSpherical()

Definition at line 1880 of file Vector.h.

◆ Hash()

template<typename T>
uint64 pcl::GenericVector< T >::Hash ( uint64  seed = 0) const
inline

Returns a non-cryptographic hash value computed for this vector. This function is a synonym for Hash64().

Definition at line 1456 of file Vector.h.

◆ Hash32()

template<typename T>
uint32 pcl::GenericVector< T >::Hash32 ( uint32  seed = 0) const
inline

Returns a 32-bit non-cryptographic hash value computed for this vector.

This function calls pcl::Hash32() for the internal vector data.

The seed parameter can be used to generate repeatable hash values. It can also be set to a random value in compromised environments.

Definition at line 1447 of file Vector.h.

◆ Hash64()

template<typename T>
uint64 pcl::GenericVector< T >::Hash64 ( uint64  seed = 0) const
inline

Returns a 64-bit non-cryptographic hash value computed for this vector.

This function calls pcl::Hash64() for the internal vector data.

The seed parameter can be used to generate repeatable hash values. It can also be set to a random value in compromised environments.

Definition at line 1434 of file Vector.h.

◆ IndexOfLargestComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfLargestComponent ( ) const
inline

Returns the index of the largest vector component.

For empty vectors, this function returns zero. For vectors where the largest component occurs more than once, this function returns the index of the first occurrence.

Definition at line 881 of file Vector.h.

Referenced by pcl::GenericInPlaceSVD< float >::IndexOfLargestSingularValue(), and pcl::GenericSVD< float >::IndexOfLargestSingularValue().

◆ IndexOfLastLargestComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfLastLargestComponent ( ) const
inline

Returns the index of the last occurrence of the largest vector component.

For empty vectors, this function returns zero. For vectors where the largest component occurs more than once, this function returns the index of the last occurrence.

Definition at line 912 of file Vector.h.

◆ IndexOfLastSmallestComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfLastSmallestComponent ( ) const
inline

Returns the index of the last occurrence of the smallest vector component.

For empty vectors, this function returns zero. For vectors where the smallest component occurs more than once, this function returns the index of the last occurrence.

Definition at line 894 of file Vector.h.

◆ IndexOfLastSmallestNonzeroComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfLastSmallestNonzeroComponent ( ) const
inline

Returns the index of the last occurrence of the smallest nonzero vector component.

For empty vectors, this function returns zero. For vectors where the smallest nonzero component occurs more than once, this function returns the index of the last occurrence.

Definition at line 948 of file Vector.h.

◆ IndexOfSmallestComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfSmallestComponent ( ) const
inline

Returns the index of the smallest vector component.

For empty vectors, this function returns zero. For vectors where the smallest component occurs more than once, this function returns the index of the first occurrence.

Definition at line 869 of file Vector.h.

◆ IndexOfSmallestNonzeroComponent()

template<typename T>
int pcl::GenericVector< T >::IndexOfSmallestNonzeroComponent ( ) const
inline

Returns the index of the smallest nonzero vector component.

For empty vectors, this function returns zero. For vectors where the smallest nonzero component occurs more than once, this function returns the index of the first occurrence.

Definition at line 929 of file Vector.h.

Referenced by pcl::GenericInPlaceSVD< float >::IndexOfSmallestSingularValue(), and pcl::GenericSVD< float >::IndexOfSmallestSingularValue().

◆ IsAliasOf()

template<typename T>
bool pcl::GenericVector< T >::IsAliasOf ( const GenericVector< T > &  x) const
inline

Returns true iff this instance references (shares) the same vector data as another instance x.

Definition at line 1473 of file Vector.h.

◆ IsEmpty()

template<typename T>
bool pcl::GenericVector< T >::IsEmpty ( ) const
inline

Returns true iff this is an empty vector. An empty vector has no components, and hence its length is zero.

Definition at line 1539 of file Vector.h.

◆ IsUnique()

template<typename T>
bool pcl::GenericVector< T >::IsUnique ( ) const
inline

Returns true iff this instance uniquely references its vector data.

Definition at line 1464 of file Vector.h.

◆ IsValid()

template<typename T>
bool pcl::GenericVector< T >::IsValid ( ) const
inline

Returns true only if this vector is valid. A vector is valid if it references an internal vector structure, even if it is an empty vector.

In general, all GenericVector objects are valid with only two exceptions:

  • Objects that have been move-copied or move-assigned to other vectors.
  • Objects that have been invalidated explicitly by calling Transfer().

An invalid vector object cannot be used and should be destroyed immediately. Invalid vectors are always destroyed automatically during move construction and move assignment operations.

Definition at line 1530 of file Vector.h.

◆ L1Norm()

template<typename T>
double pcl::GenericVector< T >::L1Norm ( ) const
inline

Returns the L1 norm (or Manhattan norm) of this vector. The L1 norm is the sum of the absolute values of all vector components.

Definition at line 711 of file Vector.h.

◆ L2Norm()

template<typename T>
double pcl::GenericVector< T >::L2Norm ( ) const
inline

Returns the L2 norm (or Euclidean norm) of this vector. The L2 norm is the square root of the sum of squared vector components.

Definition at line 720 of file Vector.h.

◆ Length()

◆ MAD() [1/2]

template<typename T>
double pcl::GenericVector< T >::MAD ( double  center) const
inline

Returns the median absolute deviation (MAD) with respect to the specified center value.

The MAD is a well-known robust estimator of scale.

For vectors with less than two components, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.4826.

Definition at line 1246 of file Vector.h.

◆ MAD() [2/2]

template<typename T>
double pcl::GenericVector< T >::MAD ( ) const
inline

Returns the median absolute deviation from the median (MAD).

The MAD is a well-known robust estimator of scale.

For vectors with less than two components, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.4826.

Definition at line 1261 of file Vector.h.

◆ MaxComponent()

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

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

Definition at line 974 of file Vector.h.

◆ Mean()

template<typename T>
double pcl::GenericVector< T >::Mean ( ) const
inline

Returns the mean of the values in this vector. For empty vectors, this function returns zero.

Definition at line 1089 of file Vector.h.

◆ Median() [1/2]

template<typename T>
double pcl::GenericVector< T >::Median ( )
inline

Returns the median of the values in this vector.

For vectors of length < 2, this function returns zero conventionally.

Before computing the median, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Note
This is a destructive median calculation algorithm: it alters the order in the sequence of vector components. For a nondestructive version, see the const version of this member function.

Definition at line 1138 of file Vector.h.

Referenced by pcl::GenericVector< sample *>::Median().

◆ Median() [2/2]

template<typename T>
double pcl::GenericVector< T >::Median ( ) const
inline

Returns the median of the values in this vector, without modifying this instance.

For vectors of length < 2, this function returns zero conventionally.

This is a nondestructive median calculation routine that doesn't modify the order of existing vector components. To achieve that goal, this routine simply generates a temporary working vector as a copy of this object, then calls its Median() member function to obtain the function's return value.

Definition at line 1156 of file Vector.h.

◆ MinComponent()

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

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

Definition at line 963 of file Vector.h.

◆ Modulus()

template<typename T>
double pcl::GenericVector< T >::Modulus ( ) const
inline

Returns the sum of the absolute values of all vector components. For empty vectors, this function returns zero.

Definition at line 1049 of file Vector.h.

◆ Norm() [1/2]

template<typename T>
double pcl::GenericVector< T >::Norm ( double  p) const
inline

Returns the norm of this vector. For any real p > 0, the norm N of a vector v is given by:

N = sum( abs( x )^p )^(1/p)

for all vector components x of v.

See also
L1Norm(), L2Norm()

Definition at line 702 of file Vector.h.

◆ Norm() [2/2]

template<typename T>
double pcl::GenericVector< T >::Norm ( ) const
inline

Returns the L2 norm (or Euclidean norm) of this vector. This function is a synonym for L2Norm().

Definition at line 729 of file Vector.h.

◆ operator bool()

template<typename T>
pcl::GenericVector< T >::operator bool ( ) const
inline

Returns true iff this vector is not empty. This operator is equivalent to:

!IsEmpty();

Definition at line 1549 of file Vector.h.

◆ operator*() [1/2]

template<typename T>
iterator pcl::GenericVector< T >::operator* ( )
inline

Returns a mutable vector iterator pointing to the first vector component, i.e. to the component at index 0 of this vector.

This member function is a convenience alias to Begin().

Definition at line 1650 of file Vector.h.

◆ operator*() [2/2]

template<typename T>
const_iterator pcl::GenericVector< T >::operator* ( ) const
inline

Returns an immutable vector iterator pointing to the first vector component, i.e. to the component at index 0 of this vector.

This member function is a convenience alias to Begin() const.

Definition at line 1661 of file Vector.h.

◆ operator*=() [1/2]

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

Component-wise vector multiplication/assignment. Multiplies each component of this vector by the corresponding component of the specified vector x. Returns a reference to this object.

Before operating vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

If the specified vectors are incompatible for component-wise operations (because the length of x is less than the length of this object), this function throws an appropriate Error exception.

Definition at line 446 of file Vector.h.

◆ operator*=() [2/2]

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

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

Before multiplying all vector components by a constant value, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 535 of file Vector.h.

◆ operator+=() [1/2]

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

Vector addition/assignment. Adds each component of the specified vector x to the corresponding component of this vector. Returns a reference to this object.

Before operating vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

If the specified vectors are incompatible for component-wise operations (because the length of x is less than the length of this object), this function throws an appropriate Error exception.

Definition at line 398 of file Vector.h.

◆ operator+=() [2/2]

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

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

Before adding a constant value to all vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 509 of file Vector.h.

◆ operator-=() [1/2]

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

Vector subtraction/assignment. Subtracts each component of the specified vector x from the corresponding component of this vector. Returns a reference to this object.

Before operating vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

If the specified vectors are incompatible for component-wise operations (because the length of x is less than the length of this object), this function throws an appropriate Error exception.

Definition at line 422 of file Vector.h.

◆ operator-=() [2/2]

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

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

Before subtracting a constant value from all vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 522 of file Vector.h.

◆ operator/=() [1/2]

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

Component-wise vector division/assignment. Divides each component of this vector by the corresponding component of the specified vector x. Returns a reference to this object.

Before operating vector components, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

If the specified vectors are incompatible for component-wise operations (because the length of x is less than the length of this object), this function throws an appropriate Error exception.

Note
Make sure that no component of the specified divisor vector x is zero or insignificant, or calling this member function will lead to division(s) by zero.

Definition at line 474 of file Vector.h.

◆ operator/=() [2/2]

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

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

Before dividing all vector components by a constant value, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 548 of file Vector.h.

◆ operator<()

template<typename T>
bool pcl::GenericVector< T >::operator< ( const GenericVector< T > &  x) const
inline

Less than relational operator. Returns true if this vector is less than another vector x.

In this operator, vector comparisons are performed component-wise, irrespective of vector lengths, until either two vector components differ or until the end of one of the vectors is reached. In the latter case, the shortest vector is the lesser one.

Definition at line 1573 of file Vector.h.

◆ operator=() [1/3]

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

Copy assignment operator. Returns a reference to this object.

See the Assign() member function for more information.

Definition at line 278 of file Vector.h.

◆ operator=() [2/3]

template<typename T>
GenericVector& pcl::GenericVector< T >::operator= ( GenericVector< T > &&  x)
inline

Move assignment operator. Returns a reference to this object.

See the Transfer() member function for more information.

Definition at line 308 of file Vector.h.

◆ operator=() [3/3]

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

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

Before assigning a constant value to all vector components, this function ensures that this instance uniquely references its vector data, generating a new vector data block if necessary.

Definition at line 371 of file Vector.h.

◆ operator==()

template<typename T>
bool pcl::GenericVector< T >::operator== ( const GenericVector< T > &  x) const
inline

Equality operator. Returns true if this vector is equal to another vector x. Two vectors are equal if both have the same length and identical component values.

Definition at line 1559 of file Vector.h.

◆ operator[]() [1/2]

template<typename T>
component& pcl::GenericVector< T >::operator[] ( int  i)
inline

Returns a reference to the mutable vector component at the specified index i. Vector indices are relative to zero.

Before returning, this function ensures that this instance uniquely references its vector data.

Definition at line 1711 of file Vector.h.

◆ operator[]() [2/2]

template<typename T>
const component& pcl::GenericVector< T >::operator[] ( int  i) const
inline

Returns a reference to the immutable vector component at the specified index i. Vector indices are relative to zero.

Definition at line 1720 of file Vector.h.

◆ operator^=()

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

Raises all components of this vector to a constant scalar x. Returns a reference to this object.

Before raising all vector components to a constant value, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 561 of file Vector.h.

◆ OrderStatistic() [1/2]

template<typename T>
component pcl::GenericVector< T >::OrderStatistic ( int  k)
inline

Returns the kth order statistic of the sample in this vector.

Before selecting the specified vector component, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

The specified index k must be valid, that is, it must be in the range [0,Length()-1]. If a value of k outside the valid range is specified, or equivalently, if this function is called for an empty vector, this member function will invoke undefined behavior.

Note
This function uses a destructive selection algorithm: it alters the order in the sequence of vector components. For a nondestructive version, see the const version of this member function.

Definition at line 997 of file Vector.h.

Referenced by pcl::GenericVector< sample *>::OrderStatistic().

◆ OrderStatistic() [2/2]

template<typename T>
component pcl::GenericVector< T >::OrderStatistic ( int  k) const
inline

Returns the kth order statistic of the sample in this vector, without modifying this instance.

The specified index k must be valid, that is, it must be in the range [0,Length()-1]. If a value of k outside the valid range is specified, or equivalently, if this function is called for an empty vector, this member function will invoke undefined behavior.

This is a nondestructive selection routine that doesn't modify the order of existing vector components. To achieve that goal, this routine simply generates a temporary working vector as a copy of this object, then calls its OrderStatistic() member function to obtain the function's return value.

Definition at line 1020 of file Vector.h.

◆ Qn()

template<typename T>
double pcl::GenericVector< T >::Qn ( ) const
inline

Returns the Qn scale estimator of Rousseeuw and Croux:

Qn = c * first_quartile( |x_i - x_j| : i < j )

where first_quartile() is the order statistic of rank (n + 1)/4.

For vectors with less than two components, this function returns zero.

The constant c = 2.2219 must be used to make the Qn estimator converge to the standard deviation of a pure normal distribution. However, this implementation does not apply it (it uses c=1 implicitly), for consistency with other implementations of scale estimators.

References

P.J. Rousseeuw and C. Croux (1993), Alternatives to the Median Absolute Deviation, Journal of the American Statistical Association, Vol. 88, pp. 1273-1283.

Definition at line 1418 of file Vector.h.

◆ ReverseSort()

template<typename T>
void pcl::GenericVector< T >::ReverseSort ( )
inline

Sorts the components of this vector in reverse (descending) order.

Definition at line 780 of file Vector.h.

◆ ReverseSorted()

template<typename T>
GenericVector pcl::GenericVector< T >::ReverseSorted ( ) const
inline

Returns a reverse sorted copy of this vector.

Definition at line 790 of file Vector.h.

◆ SameLength()

template<typename T>
bool pcl::GenericVector< T >::SameLength ( const GenericVector< T > &  x) const
inline

Returns true iff this vector has the same length as other vector x.

Definition at line 1581 of file Vector.h.

◆ SetAbs()

template<typename T>
void pcl::GenericVector< T >::SetAbs ( )
inline

Replaces all components of this vector with their absolute values.

Before performing its task, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 675 of file Vector.h.

◆ SetSqr()

template<typename T>
void pcl::GenericVector< T >::SetSqr ( )
inline

Replaces all components of this vector with their squares.

Before performing its task, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 601 of file Vector.h.

◆ SetSqrt()

template<typename T>
void pcl::GenericVector< T >::SetSqrt ( )
inline

Replaces all components of this vector with their square roots.

Before performing its task, this function ensures that this instance uniquely references its vector data, generating a duplicate if necessary.

Definition at line 638 of file Vector.h.

◆ SetUnit()

template<typename T>
void pcl::GenericVector< T >::SetUnit ( )
inline

Transforms this vector to a unit vector with the same direction. A unit vector has a norm (or magnitude) of 1.

Definition at line 751 of file Vector.h.

◆ Size()

template<typename T>
size_type pcl::GenericVector< T >::Size ( ) const
inline

Returns the total number of bytes required to store the data contained in this vector.

Definition at line 1511 of file Vector.h.

◆ Sn()

template<typename T>
double pcl::GenericVector< T >::Sn ( ) const
inline

Returns the Sn scale estimator of Rousseeuw and Croux:

Sn = c * low_median( high_median( |x_i - x_j| ) )

where low_median() is the order statistic of rank (n + 1)/2, and high_median() is the order statistic of rank n/2 + 1.

For vectors with less than two components, this function returns zero.

The constant c = 1.1926 must be used to make the Sn estimator converge to the standard deviation of a pure normal distribution. However, this implementation does not apply it (it uses c=1 implicitly), for consistency with other implementations of scale estimators.

References

P.J. Rousseeuw and C. Croux (1993), Alternatives to the Median Absolute Deviation, Journal of the American Statistical Association, Vol. 88, pp. 1273-1283.

Definition at line 1392 of file Vector.h.

◆ Sort() [1/2]

template<typename T>
void pcl::GenericVector< T >::Sort ( )
inline

Sorts the components of this vector in ascending order.

Definition at line 761 of file Vector.h.

◆ Sort() [2/2]

template<typename T>
template<class BP >
void pcl::GenericVector< T >::Sort ( BP  p)
inline

Sorts the components of this vector in ascending order. Ordering of vector components is defined such that for any pair a, b of vector components, the specified binary predicate p( a, b ) is true if a precedes b.

Definition at line 804 of file Vector.h.

◆ Sorted() [1/2]

template<typename T>
GenericVector pcl::GenericVector< T >::Sorted ( ) const
inline

Returns a sorted copy of this vector.

Definition at line 770 of file Vector.h.

◆ Sorted() [2/2]

template<typename T>
template<class BP >
GenericVector pcl::GenericVector< T >::Sorted ( BP  p) const
inline

Returns a sorted copy of this vector, where ordering of vector components is defined by the specified binary predicate p. See Sort( BP p ).

Definition at line 815 of file Vector.h.

◆ Sqr()

template<typename T>
GenericVector pcl::GenericVector< T >::Sqr ( ) const
inline

Returns the square of this vector. The result is a new vector of the same length where each component is the square of its counterpart in this vector.

Definition at line 586 of file Vector.h.

◆ Sqrt()

template<typename T>
GenericVector pcl::GenericVector< T >::Sqrt ( ) const
inline

Returns the square root of this vector. The result is a new vector of the same length where each component is the square root of its counterpart in this vector.

Definition at line 623 of file Vector.h.

◆ StableAvgDev() [1/2]

template<typename T>
double pcl::GenericVector< T >::StableAvgDev ( double  center) const
inline

Computes the average absolute deviation with respect to the specified center value, using a numerically stable summation algorithm to minimize roundoff error.

When the median of the vector elements is used as the center value, this function returns the average absolute deviation from the median, which is a well-known estimator of dispersion.

For vectors with less than two components, this function returns zero.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 1195 of file Vector.h.

◆ StableAvgDev() [2/2]

template<typename T>
double pcl::GenericVector< T >::StableAvgDev ( ) const
inline

Computes the average absolute deviation from the median using a numerically stable summation algorithm to minimize roundoff error.

The mean absolute deviation from the median is a well-known estimator of dispersion.

For vectors with less than two components, this function returns zero.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 1230 of file Vector.h.

◆ StableMean()

template<typename T>
double pcl::GenericVector< T >::StableMean ( ) const
inline

Computes the mean of the values in this vector using a numerically stable summation algorithm to minimize roundoff error.

For empty vectors, this function returns zero.

Definition at line 1100 of file Vector.h.

◆ StableModulus()

template<typename T>
double pcl::GenericVector< T >::StableModulus ( ) const
inline

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

For empty vectors, this function returns zero.

Definition at line 1060 of file Vector.h.

◆ StableSum()

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

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

For empty vectors, this function returns zero.

Definition at line 1040 of file Vector.h.

◆ StableSumOfSquares()

template<typename T>
double pcl::GenericVector< T >::StableSumOfSquares ( ) const
inline

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

For empty vectors, this function returns zero.

Definition at line 1080 of file Vector.h.

◆ StdDev()

template<typename T>
double pcl::GenericVector< T >::StdDev ( ) const
inline

Returns the standard deviation from the mean for the values in this vector.

For vectors with less than two components, this function returns zero.

Definition at line 1121 of file Vector.h.

◆ Sum()

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

Returns the sum of vector components. For empty vectors, this function returns zero.

Definition at line 1029 of file Vector.h.

◆ SumOfSquares()

template<typename T>
double pcl::GenericVector< T >::SumOfSquares ( ) const
inline

Computes the sum of the squares of all vector components. For empty vectors, this function returns zero.

Definition at line 1069 of file Vector.h.

◆ ToCommaSeparated()

template<typename T>
template<class S >
S& pcl::GenericVector< T >::ToCommaSeparated ( S &  s) const
inline

Generates a comma-separated sequence of string tokens. Returns a reference to the target string s.

This function is equivalent to:

ToSeparated( s, ',' );

Definition at line 1974 of file Vector.h.

◆ ToSeparated() [1/2]

template<typename T>
template<class S , typename SP >
S& pcl::GenericVector< T >::ToSeparated ( S &  s,
SP  separator 
) const
inline

Generates a sequence of string tokens separated with the specified separator string. Returns a reference to the target string s.

For each vector component, this function appends a string representation (known as a token) to the target string s. If the vector has more than one component, successive tokens are separated with the specified separator.

The string type S must have a meaningful Append() member function and type conversion semantics to transform a vector component to a string. The standard String and IsoString PCL classes provide the required functionality for most scalar types, although it is probably better to use String::ToSeparated() and IsoString::ToSeparated() instead of calling these functions directly.

Definition at line 1905 of file Vector.h.

◆ ToSeparated() [2/2]

template<typename T>
template<class S , typename SP , class AF >
S& pcl::GenericVector< T >::ToSeparated ( S &  s,
SP  separator,
AF  append 
) const
inline

Generates a sequence of string tokens separated with the specified separator string by calling an append function. Returns a reference to the target string s.

For each vector component x, this function appends a string representation (known as a token) to the target string s by calling the append function:

append( s, S( x ) );

If the vector has more than one component, successive tokens are separated by calling:

append( s, S( separator ) );

The string type S must have type conversion semantics to transform a vector component to a string. The standard String and IsoString PCL classes provide the required functionality for most scalar types, although it is probably better to use String::ToSeparated() and IsoString::ToSeparated() instead of calling these functions directly.

Definition at line 1945 of file Vector.h.

◆ ToSpaceSeparated()

template<typename T>
template<class S >
S& pcl::GenericVector< T >::ToSpaceSeparated ( S &  s) const
inline

Generates a space-separated sequence of string tokens. Returns a reference to the target string s.

This function is equivalent to:

ToSeparated( s, ' ' );

Definition at line 1988 of file Vector.h.

◆ ToSpherical()

template<typename T>
template<typename T1 , typename T2 >
void pcl::GenericVector< T >::ToSpherical ( T1 &  lon,
T2 &  lat 
) const
inline

Computes spherical coordinates from this three-component vector.

Parameters
[out]lonReference to a variable where the computed longitude in radians, in the range [-pi,+pi], will be stored. If the vector points to one pole, that is, if *lat is either -pi/2 or +pi/2, the computed longitude will be zero.
[out]latReference to a variable where the computed latitude in radians, in the range [-pi/2,+pi/2], will be stored.

This function requires a vector with at least three coordinates. For performance reasons, the vector length is not verified.

The returned coordinates lie on a sphere of unit radius, that is, only the direction of the input vector is taken into account, never its magnitude.

See also
ToSpherical2Pi(), FromSpherical()

Definition at line 1819 of file Vector.h.

◆ ToSpherical2Pi()

template<typename T>
template<typename T1 , typename T2 >
void pcl::GenericVector< T >::ToSpherical2Pi ( T1 &  lon,
T2 &  lat 
) const
inline

Computes spherical coordinates from this three-component vector.

This function is identical to ToSpherical(), but the output longitude component is normalized to the range [0,2pi) in radians.

See also
ToSpherical(), FromSpherical()

Definition at line 1839 of file Vector.h.

◆ ToTabSeparated()

template<typename T>
template<class S >
S& pcl::GenericVector< T >::ToTabSeparated ( S &  s) const
inline

Generates a tabulator-separated sequence of string tokens. Returns a reference to the target string s.

This function is equivalent to:

ToSeparated( s, '\t' );

Definition at line 2002 of file Vector.h.

◆ Transfer() [1/2]

template<typename T>
void pcl::GenericVector< T >::Transfer ( GenericVector< T > &  x)
inline

Transfers data from another vector x to this object.

Decrements the reference counter of the current vector data. If the data becomes unreferenced, it is destroyed and deallocated. The vector data referenced by the source object x is then transferred to this object, and the source object x is left as an invalid empty vector.

Warning
The source vector x will be an invalid object after calling this function, and hence should be destroyed immediately. Any attempt to access an invalid object will most likely lead to a crash.

Definition at line 326 of file Vector.h.

◆ Transfer() [2/2]

template<typename T>
void pcl::GenericVector< T >::Transfer ( GenericVector< T > &&  x)
inline

Transfers data from another vector x to this object.

Decrements the reference counter of the current vector data. If the data becomes unreferenced, it is destroyed and deallocated. The vector data referenced by the source object x is then transferred to this object, and the source object x is left as an invalid empty vector.

Warning
The source vector x will be an invalid object after calling this function, and hence should be destroyed immediately. Any attempt to access an invalid object will most likely lead to a crash.

Definition at line 345 of file Vector.h.

◆ Unit()

template<typename T>
GenericVector pcl::GenericVector< T >::Unit ( ) const
inline

Returns a unit vector with the same direction as this vector. A unit vector has a norm (or magnitude) of 1.

Definition at line 738 of file Vector.h.

◆ Variance()

template<typename T>
double pcl::GenericVector< T >::Variance ( ) const
inline

Returns the variance from the mean for the values in this vector.

For vectors with less than two components, this function returns zero.

Definition at line 1110 of file Vector.h.

Friends And Related Function Documentation

◆ Swap

template<typename T>
void Swap ( GenericVector< T > &  x1,
GenericVector< T > &  x2 
)
friend

Exchanges two vectors x1 and x2.

This function is efficient because it simply swaps the internal vector data pointers owned by the objects.

Definition at line 358 of file Vector.h.


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