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)
 
template<typename T1 >
 GenericVector (const GenericVector< T1 > &x)
 
virtual ~GenericVector ()
 
GenericVector Abs () const
 
double Angle2D (const GenericVector &v) const noexcept
 
double Angle3D (const GenericVector &v) const noexcept
 
double Angle3D (const GenericVector &v, const GenericVector &n) const
 
void Assign (const GenericVector &x)
 
iterator At (int i)
 
const_iterator At (int i) const noexcept
 
double AvgDev (double center) const noexcept
 
double AvgDev () const
 
iterator Begin ()
 
const_iterator Begin () const noexcept
 
iterator begin ()
 
const_iterator begin () const noexcept
 
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, bool reducedLength=false) const noexcept
 
double BiweightMidvariance (int k=9, bool reducedLength=false) const
 
void Clear ()
 
iterator ComponentPtr (int i) noexcept
 
const_iterator ConstBegin () const noexcept
 
const_iterator ConstEnd () const noexcept
 
bool Contains (const component &x) const noexcept
 
GenericVector Cross (const GenericVector &v2) const
 
iterator DataPtr () noexcept
 
scalar Dot (const GenericVector &v) const noexcept
 
iterator End ()
 
const_iterator End () const noexcept
 
iterator end ()
 
const_iterator end () const noexcept
 
void EnsureUnique ()
 
int Find (const component &x) const noexcept
 
int FindFirst (const component &x) const noexcept
 
int FindLast (const component &x) const noexcept
 
uint64 Hash (uint64 seed=0) const noexcept
 
uint32 Hash32 (uint32 seed=0) const noexcept
 
uint64 Hash64 (uint64 seed=0) const noexcept
 
int IndexOfLargestComponent () const noexcept
 
int IndexOfLastLargestComponent () const noexcept
 
int IndexOfLastSmallestComponent () const noexcept
 
int IndexOfLastSmallestNonzeroComponent () const noexcept
 
int IndexOfSmallestComponent () const noexcept
 
int IndexOfSmallestNonzeroComponent () const noexcept
 
bool IsAliasOf (const GenericVector &x) const noexcept
 
bool IsEmpty () const noexcept
 
bool IsUnique () const noexcept
 
bool IsValid () const noexcept
 
scalar L1Norm () const noexcept
 
scalar L2Norm () const noexcept
 
int Length () const noexcept
 
double MAD (double center) const
 
double MAD () const
 
component MaxComponent () const noexcept
 
double Mean () const
 
double Median () const
 
component MinComponent () const noexcept
 
double Modulus () const noexcept
 
scalar Norm (double p) const noexcept
 
scalar Norm () const noexcept
 
 operator bool () const noexcept
 
iterator operator* ()
 
const_iterator operator* () const noexcept
 
GenericVectoroperator*= (const GenericVector &x)
 
GenericVectoroperator*= (const scalar &x)
 
GenericVectoroperator+= (const GenericVector &x)
 
GenericVectoroperator+= (const scalar &x)
 
GenericVector operator- () const
 
GenericVectoroperator-= (const GenericVector &x)
 
GenericVectoroperator-= (const scalar &x)
 
GenericVectoroperator/= (const GenericVector &x)
 
GenericVectoroperator/= (const scalar &x)
 
bool operator< (const GenericVector &x) const noexcept
 
GenericVectoroperator= (const GenericVector &x)
 
GenericVectoroperator= (GenericVector &&x)
 
GenericVectoroperator= (const scalar &x)
 
bool operator== (const GenericVector &x) const noexcept
 
componentoperator[] (int i)
 
const componentoperator[] (int i) const noexcept
 
GenericVectoroperator^= (const scalar &x)
 
component OrderStatistic (int k)
 
component OrderStatistic (int k) const
 
double Qn () const
 
void ReverseSign ()
 
void ReverseSort ()
 
GenericVector ReverseSorted () const
 
bool SameLength (const GenericVector &x) const noexcept
 
void SetAbs ()
 
void SetSqr ()
 
void SetSqrt ()
 
void SetUnit ()
 
size_type Size () const noexcept
 
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 noexcept
 
double StableAvgDev () const
 
double StableMean () const noexcept
 
double StableModulus () const noexcept
 
double StableSum () const noexcept
 
double StableSumOfSquares () const noexcept
 
double StdDev () const noexcept
 
double Sum () const noexcept
 
double SumOfSquares () const noexcept
 
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 noexcept
 
template<typename T1 , typename T2 >
void ToSpherical2Pi (T1 &lon, T2 &lat) const noexcept
 
template<class S >
S & ToTabSeparated (S &s) const
 
void Transfer (GenericVector &x)
 
void Transfer (GenericVector &&x)
 
double TrimmedMean (distance_type l=1, distance_type h=1) const noexcept
 
double TrimmedMeanOfSquares (distance_type l=1, distance_type h=1) const noexcept
 
TwoSidedEstimate TwoSidedAvgDev (double center) const noexcept
 
TwoSidedEstimate TwoSidedAvgDev () const
 
TwoSidedEstimate TwoSidedBiweightMidvariance (double center, const TwoSidedEstimate &sigma, int k=9, bool reducedLength=false) const noexcept
 
TwoSidedEstimate TwoSidedBiweightMidvariance (int k=9, bool reducedLength=false) const
 
TwoSidedEstimate TwoSidedMAD (double center) const
 
TwoSidedEstimate TwoSidedMAD () const
 
GenericVector Unit () const
 
double Variance () const noexcept
 

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) noexcept
 

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/10]

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/10]

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/10]

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/10]

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 179 of file Vector.h.

◆ GenericVector() [5/10]

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 202 of file Vector.h.

◆ GenericVector() [6/10]

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 212 of file Vector.h.

◆ GenericVector() [7/10]

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 226 of file Vector.h.

◆ GenericVector() [8/10]

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 240 of file Vector.h.

◆ GenericVector() [9/10]

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

Move constructor.

Definition at line 249 of file Vector.h.

◆ GenericVector() [10/10]

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

Constructs a vector and initializes it with component values taken from an instance x of a different vector template instantiation.

This constructor is equivalent to:

GenericVector( x.Begin(), x.Length() )

Definition at line 264 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 274 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 821 of file Vector.h.

◆ Angle2D()

template<typename T>
double pcl::GenericVector< T >::Angle2D ( const GenericVector< T > &  v) const
inlinenoexcept

Returns the angle between this vector and another vector v, with both vectors being defined in two-dimensional space.

The returned value is the angle between both vectors in radians, in the range [-pi,+pi].

Note
This member function is only defined for vectors of two components. For performance reasons, this condition is not verified; if it doesn't hold, this function will invoke undefined behavior.

Definition at line 2169 of file Vector.h.

◆ Angle3D() [1/2]

template<typename T>
double pcl::GenericVector< T >::Angle3D ( const GenericVector< T > &  v) const
inlinenoexcept

Returns the angle between this vector and another vector v, with both vectors being defined in three-dimensional space.

The returned value is the angle between both vectors in radians, in the range [0,pi].

Note
This member function is only defined for vectors of three components. For performance reasons, this condition is not verified; if it doesn't hold, this function will invoke undefined behavior.

Definition at line 2193 of file Vector.h.

◆ Angle3D() [2/2]

template<typename T>
double pcl::GenericVector< T >::Angle3D ( const GenericVector< T > &  v,
const GenericVector< T > &  n 
) const
inline

Returns the angle between this vector and another vector v, being both vectors defined in three-dimensional space, with sign determined by the direction of an additional 3D vector n.

The returned value is the angle between both vectors in radians, in the range [-pi,+pi]. The angle is positive if this vector is clockwise with respect to the direction of n, negative otherwise.

Note
This member function is only defined for vectors of three components. For performance reasons, this condition is not verified; if it doesn't hold, this function will invoke undefined behavior.

Definition at line 2214 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 322 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 1863 of file Vector.h.

◆ At() [2/2]

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

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

Definition at line 1873 of file Vector.h.

◆ AvgDev() [1/2]

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

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 1345 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 1382 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 1888 of file Vector.h.

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

◆ Begin() [2/2]

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

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 1901 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 2037 of file Vector.h.

◆ begin() [2/2]

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

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

Definition at line 2045 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 a 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 (2017), Introduction to Robust Estimation and Hypothesis Testing, 4th Edition, Elsevier Inc., Section 3.12.3.

Definition at line 1605 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 a 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 (2017), Introduction to Robust Estimation and Hypothesis Testing, 4th Edition, Elsevier Inc., Section 3.12.3.

Definition at line 1629 of file Vector.h.

◆ BiweightMidvariance() [1/2]

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

Returns the 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.
reducedLengthIf true, reduce the sample size to exclude rejected vector components. This tends to approximate the true dispersion of the data more accurately for relatively small samples, or samples with large amounts of outliers. Note that this departs from the standard definition of biweight midvariance, where the total number of data items is used to scale the variance estimate. If false, use the full vector length, including rejected components, which gives a standard biweight midvariance estimate.

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 (2017), Introduction to Robust Estimation and Hypothesis Testing, 4th Edition, Elsevier Inc., Section 3.12.1.

Definition at line 1512 of file Vector.h.

◆ BiweightMidvariance() [2/2]

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

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

Parameters
kRejection limit in sigma units. The default value is k=9.
reducedLengthIf true, reduce the sample size to exclude rejected vector components. This tends to approximate the true dispersion of the data more accurately for relatively small samples, or samples with large amounts of outliers. Note that this departs from the standard definition of biweight midvariance, where the total number of data items is used to scale the variance estimate. If false, use the full vector length, including rejected components, which gives a standard biweight midvariance estimate.

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 (2017), Introduction to Robust Estimation and Hypothesis Testing, 4th Edition, Elsevier Inc., Section 3.12.1.

Definition at line 1545 of file Vector.h.

◆ Clear()

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

Deallocates vector data, yielding an empty vector.

Definition at line 286 of file Vector.h.

◆ ComponentPtr()

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

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 2028 of file Vector.h.

◆ ConstBegin()

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

A synonym for Begin() const.

Definition at line 1909 of file Vector.h.

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

◆ ConstEnd()

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

A synonym for End() const.

Definition at line 1969 of file Vector.h.

◆ Contains()

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

Returns true iff this vector contains the specified value x.

Definition at line 1026 of file Vector.h.

◆ Cross()

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

Returns the cross product of this vector and a vector v2.

Note
The cross product is only defined for vectors of three components. For performance reasons, this function does not check vector lengths. For vectors of length < 3, this function will invoke undefined behavior.

Definition at line 663 of file Vector.h.

◆ DataPtr()

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

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 2013 of file Vector.h.

◆ Dot()

template<typename T>
scalar pcl::GenericVector< T >::Dot ( const GenericVector< T > &  v) const
inlinenoexcept

Returns the dot product of this vector and a vector v.

Note
For performance reasons, this function does not check whether the specified vector has at least the same number of components as this vector. If that condition does not hold, this function will invoke undefined behavior.

Definition at line 643 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 1947 of file Vector.h.

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

◆ End() [2/2]

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

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 1961 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 2053 of file Vector.h.

◆ end() [2/2]

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

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

Definition at line 2061 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 1752 of file Vector.h.

◆ Find()

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

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 997 of file Vector.h.

◆ FindFirst()

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

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 1008 of file Vector.h.

◆ FindLast()

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

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 1017 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 2131 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 2150 of file Vector.h.

◆ Hash()

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

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

Definition at line 1723 of file Vector.h.

◆ Hash32()

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

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 1714 of file Vector.h.

◆ Hash64()

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

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 1701 of file Vector.h.

◆ IndexOfLargestComponent()

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

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 1052 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
inlinenoexcept

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 1083 of file Vector.h.

◆ IndexOfLastSmallestComponent()

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

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 1065 of file Vector.h.

◆ IndexOfLastSmallestNonzeroComponent()

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

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 1119 of file Vector.h.

◆ IndexOfSmallestComponent()

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

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 1040 of file Vector.h.

◆ IndexOfSmallestNonzeroComponent()

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

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 1100 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
inlinenoexcept

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

Definition at line 1740 of file Vector.h.

◆ IsEmpty()

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

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

Definition at line 1809 of file Vector.h.

◆ IsUnique()

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

Returns true iff this instance uniquely references its vector data.

Definition at line 1731 of file Vector.h.

◆ IsValid()

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

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 1800 of file Vector.h.

◆ L1Norm()

template<typename T>
scalar pcl::GenericVector< T >::L1Norm ( ) const
inlinenoexcept

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 882 of file Vector.h.

◆ L2Norm()

template<typename T>
scalar pcl::GenericVector< T >::L2Norm ( ) const
inlinenoexcept

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 891 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 1437 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 1452 of file Vector.h.

◆ MaxComponent()

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

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

Definition at line 1145 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 1260 of file Vector.h.

◆ Median()

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

Returns the median of the values in this vector.

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

Definition at line 1326 of file Vector.h.

◆ MinComponent()

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

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

Definition at line 1134 of file Vector.h.

◆ Modulus()

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

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

Definition at line 1220 of file Vector.h.

◆ Norm() [1/2]

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

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 873 of file Vector.h.

◆ Norm() [2/2]

template<typename T>
scalar pcl::GenericVector< T >::Norm ( ) const
inlinenoexcept

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

Definition at line 900 of file Vector.h.

◆ operator bool()

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

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

!IsEmpty();

Definition at line 1819 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 1920 of file Vector.h.

◆ operator*() [2/2]

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

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 1931 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 480 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 582 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 426 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 556 of file Vector.h.

◆ operator-()

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

Unary sign reversal operator: returns a vector with the components of this vector multiplied by -1.

Definition at line 681 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 453 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 569 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 511 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 595 of file Vector.h.

◆ operator<()

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

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 1843 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 304 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 334 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 397 of file Vector.h.

◆ operator==()

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

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 1829 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 1981 of file Vector.h.

◆ operator[]() [2/2]

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

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

Definition at line 1990 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 608 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 1168 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 1191 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 1685 of file Vector.h.

◆ ReverseSign()

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

Reverses the sign of all components of this vector.

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

Definition at line 699 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 951 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 961 of file Vector.h.

◆ SameLength()

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

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

Definition at line 1851 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 839 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 746 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 793 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 922 of file Vector.h.

◆ Size()

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

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

Definition at line 1781 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 1657 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 932 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 975 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 941 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 986 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 728 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 775 of file Vector.h.

◆ StableAvgDev() [1/2]

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

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 1365 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 1400 of file Vector.h.

◆ StableMean()

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

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 1271 of file Vector.h.

◆ StableModulus()

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

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 1231 of file Vector.h.

◆ StableSum()

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

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 1211 of file Vector.h.

◆ StableSumOfSquares()

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

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 1251 of file Vector.h.

◆ StdDev()

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

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 1316 of file Vector.h.

◆ Sum()

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

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

Definition at line 1200 of file Vector.h.

◆ SumOfSquares()

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

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

Definition at line 1240 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 2309 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 2240 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 2280 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 2323 of file Vector.h.

◆ ToSpherical()

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

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 2089 of file Vector.h.

◆ ToSpherical2Pi()

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

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 2109 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 2337 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 352 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 371 of file Vector.h.

◆ TrimmedMean()

template<typename T>
double pcl::GenericVector< T >::TrimmedMean ( distance_type  l = 1,
distance_type  h = 1 
) const
inlinenoexcept

Computes the two-sided, asymmetric trimmed mean of the values in this vector. See pcl::TrimmedMean() for a complete description of the implemented algorithm with information on function parameters.

For empty vectors, this function returns zero.

Definition at line 1283 of file Vector.h.

◆ TrimmedMeanOfSquares()

template<typename T>
double pcl::GenericVector< T >::TrimmedMeanOfSquares ( distance_type  l = 1,
distance_type  h = 1 
) const
inlinenoexcept

Computes the two-sided, asymmetric trimmed mean of the squared values in this vector. See pcl::TrimmedMeanOfSquares() for a complete description of the implemented algorithm with information on function parameters.

For empty vectors, this function returns zero.

Definition at line 1295 of file Vector.h.

◆ TwoSidedAvgDev() [1/2]

template<typename T>
TwoSidedEstimate pcl::GenericVector< T >::TwoSidedAvgDev ( double  center) const
inlinenoexcept

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

See AvgDev( double ) for more information.

Definition at line 1411 of file Vector.h.

◆ TwoSidedAvgDev() [2/2]

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

Returns the two-sided average absolute deviation from the median.

See AvgDev() for more information.

Definition at line 1421 of file Vector.h.

◆ TwoSidedBiweightMidvariance() [1/2]

template<typename T>
TwoSidedEstimate pcl::GenericVector< T >::TwoSidedBiweightMidvariance ( double  center,
const TwoSidedEstimate sigma,
int  k = 9,
bool  reducedLength = false 
) const
inlinenoexcept

Returns the two-sided biweight midvariance (BWMV).

Parameters
centerReference center value. Normally, the median of the vector components should be used.
sigmaA two-sided reference estimate of dispersion. Normally, the two-sided median absolute deviation from the median (MAD) of the vector components should be used. See the TwoSidedMAD() member function.

See BiweightMidvariance( double, double, int, bool ) for more information on the rest of parameters and references.

Definition at line 1565 of file Vector.h.

◆ TwoSidedBiweightMidvariance() [2/2]

template<typename T>
TwoSidedEstimate pcl::GenericVector< T >::TwoSidedBiweightMidvariance ( int  k = 9,
bool  reducedLength = false 
) const
inline

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

See BiweightMidvariance( int, bool ) for more information and references.

Definition at line 1577 of file Vector.h.

◆ TwoSidedMAD() [1/2]

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

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

See MAD( double ) for more information.

Definition at line 1463 of file Vector.h.

◆ TwoSidedMAD() [2/2]

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

Returns the two-sided median absolute deviation from the median (MAD).

See MAD() for more information.

Definition at line 1473 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 909 of file Vector.h.

◆ Variance()

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

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 1305 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 384 of file Vector.h.


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