PCL
pcl::GenericVector< T > Class Template Reference

Generic vector of arbitrary length. More...

#include <Vector.h>

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

Public Types

using component = T
 
using const_item_type = typename container_type::const_item_type
 
using const_iterator = const T *
 
using container_type = DirectContainer< T >
 
using item_type = typename container_type::item_type
 
using iterator = T *
 
using scalar = T
 
- Public Types inherited from pcl::DirectContainer< T >
using const_item_type = const T
 
using item_type = T
 

Public Member Functions

 GenericVector ()
 
 GenericVector (const component &x, int len)
 
 GenericVector (const GenericVector &x)
 
template<typename T1 >
 GenericVector (const GenericVector< T1 > &x)
 
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)
 
template<typename T1 >
 GenericVector (const T1 *a, int len)
 
 GenericVector (GenericVector &&x)
 
 GenericVector (int len)
 
template<typename T1 >
 GenericVector (std::initializer_list< T1 > c)
 
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 () const
 
double AvgDev (double center) const noexcept
 
iterator Begin ()
 
iterator begin ()
 
const_iterator Begin () const noexcept
 
const_iterator begin () const noexcept
 
double BendMidvariance (double beta=0.2) const
 
double BendMidvariance (double center, 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 ()
 
iterator end ()
 
const_iterator End () const noexcept
 
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 () const
 
double MAD (double center) const
 
component MaxComponent () const noexcept
 
double Mean () const
 
double Median () const
 
component MinComponent () const noexcept
 
double Modulus () const noexcept
 
scalar Norm () const noexcept
 
scalar Norm (double p) 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= (const scalar &x)
 
GenericVectoroperator= (GenericVector &&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 () const
 
double StableAvgDev (double center) const noexcept
 
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 () const
 
TwoSidedEstimate TwoSidedAvgDev (double center) const noexcept
 
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 () const
 
TwoSidedEstimate TwoSidedMAD (double center) const
 
GenericVector Unit () const
 
double Variance () const noexcept
 

Static Public Member Functions

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

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 >
using pcl::GenericVector< T >::component = T

Represents a vector component.

Definition at line 130 of file Vector.h.

◆ const_item_type

template<typename T >
using pcl::GenericVector< T >::const_item_type = typename container_type::const_item_type

#

Definition at line 120 of file Vector.h.

◆ const_iterator

template<typename T >
using pcl::GenericVector< T >::const_iterator = const T*

Represents an immutable vector iterator.

Definition at line 140 of file Vector.h.

◆ container_type

template<typename T >
using pcl::GenericVector< T >::container_type = DirectContainer<T>

#

Definition at line 112 of file Vector.h.

◆ item_type

template<typename T >
using pcl::GenericVector< T >::item_type = typename container_type::item_type

#

Definition at line 116 of file Vector.h.

◆ iterator

template<typename T >
using pcl::GenericVector< T >::iterator = T*

Represents a mutable vector iterator.

Definition at line 135 of file Vector.h.

◆ scalar

template<typename T >
using pcl::GenericVector< T >::scalar = T

Represents a scalar.

Definition at line 125 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 146 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 159 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 171 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 193 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 217 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 227 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 241 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 255 of file Vector.h.

◆ GenericVector() [9/10]

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

Move constructor.

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

◆ ~GenericVector()

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

Virtual destructor. Dereferences the vector data. If the vector data becomes unreferenced, it is destroyed and deallocated immediately.

Definition at line 288 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 841 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 2215 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 2239 of file Vector.h.

References pcl::ArcTan().

◆ 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 2260 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 336 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 1893 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 1903 of file Vector.h.

◆ AvgDev() [1/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 1412 of file Vector.h.

References pcl::AvgDev().

◆ AvgDev() [2/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 1375 of file Vector.h.

References pcl::AvgDev().

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

Referenced by pcl::JPLEphemeris::ComputeState(), pcl::GenericVector< T >::Qn(), pcl::Histogram::Resample(), and pcl::GenericVector< T >::Sn().

◆ begin() [1/2]

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

STL-compatible iteration. Equivalent to Begin().

Definition at line 2067 of file Vector.h.

◆ 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 1931 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 2075 of file Vector.h.

◆ BendMidvariance() [1/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 1659 of file Vector.h.

References pcl::BendMidvariance().

◆ BendMidvariance() [2/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 1635 of file Vector.h.

References pcl::BendMidvariance().

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

References pcl::BiweightMidvariance().

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

References pcl::BiweightMidvariance(), pcl::MAD(), and pcl::Median().

◆ Clear()

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

Deallocates vector data, yielding an empty vector.

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

◆ ConstBegin()

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

A synonym for Begin() const.

Definition at line 1939 of file Vector.h.

◆ ConstEnd()

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

A synonym for End() const.

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

References pcl::LinearSearch().

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

References pcl::GenericVector< T >::Length().

◆ 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 2043 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 663 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 1977 of file Vector.h.

Referenced by pcl::GenericVector< T >::Qn(), pcl::Histogram::Resample(), and pcl::GenericVector< T >::Sn().

◆ end() [1/2]

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

STL-compatible iteration. Equivalent to End().

Definition at line 2083 of file Vector.h.

◆ 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 1991 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 2091 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 1782 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 1017 of file Vector.h.

References pcl::LinearSearch().

◆ 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 1028 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 1037 of file Vector.h.

References pcl::LinearSearchLast().

◆ FromArray()

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

Returns a new vector initialized 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 2199 of file Vector.h.

◆ FromSpherical() [1/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 2180 of file Vector.h.

References pcl::SinCos().

◆ FromSpherical() [2/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 2161 of file Vector.h.

Referenced by pcl::Position::EclipticToEquatorial(), pcl::Position::EquatorialToEcliptic(), pcl::Position::GalacticToICRSEquatorial(), and pcl::Position::ICRSEquatorialToGalactic().

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

References pcl::Hash64().

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

References pcl::Hash32().

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

References pcl::Hash64().

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

References pcl::MaxItem().

◆ 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 1103 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 1085 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 1144 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 1060 of file Vector.h.

References pcl::MinItem().

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

◆ 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 1770 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 1839 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 1761 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 1830 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 902 of file Vector.h.

References pcl::L1Norm().

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

References pcl::L2Norm().

◆ Length()

◆ MAD() [1/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 1482 of file Vector.h.

References pcl::MAD().

◆ MAD() [2/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 1467 of file Vector.h.

References pcl::MAD().

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

Referenced by pcl::GenericChebyshevFit< Tx, Ty >::IsTruncated(), and pcl::GenericChebyshevFit< Tx, Ty >::TruncatedLength().

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

References pcl::Mean().

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

References pcl::Median().

◆ 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 1164 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 1250 of file Vector.h.

References pcl::Modulus().

◆ Norm() [1/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 920 of file Vector.h.

References pcl::L2Norm().

◆ Norm() [2/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 893 of file Vector.h.

References pcl::Norm().

◆ 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();
bool IsEmpty() const noexcept
Definition: Vector.h:1839

Definition at line 1849 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 1950 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 1961 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 500 of file Vector.h.

References pcl::GenericVector< T >::Length().

◆ 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 602 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 446 of file Vector.h.

References pcl::GenericVector< T >::Length().

◆ 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 576 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 701 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 473 of file Vector.h.

References pcl::GenericVector< T >::Length().

◆ 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 589 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 531 of file Vector.h.

References pcl::GenericVector< T >::Length().

◆ 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 615 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 1873 of file Vector.h.

References pcl::Compare().

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

◆ operator=() [2/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 417 of file Vector.h.

◆ operator=() [3/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 348 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 1859 of file Vector.h.

References pcl::Equal().

◆ 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 2011 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 2020 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 628 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 1198 of file Vector.h.

References pcl::Select().

Referenced by pcl::GenericVector< T >::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 1221 of file Vector.h.

References pcl::GenericVector< T >::OrderStatistic().

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

References pcl::GenericVector< T >::Begin(), pcl::GenericVector< T >::End(), and pcl::Qn().

◆ 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 719 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 971 of file Vector.h.

References pcl::Sort().

◆ ReverseSorted()

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

Returns a reverse sorted copy of this vector.

Definition at line 981 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 1881 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 859 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 766 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 813 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 942 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 1811 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 1687 of file Vector.h.

References pcl::GenericVector< T >::Begin(), pcl::GenericVector< T >::End(), and pcl::Sn().

◆ Sort() [1/2]

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

Sorts the components of this vector in ascending order.

Definition at line 952 of file Vector.h.

References pcl::Sort().

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

References pcl::Sort().

◆ Sorted() [1/2]

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

Returns a sorted copy of this vector.

Definition at line 961 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 1006 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 748 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 795 of file Vector.h.

◆ StableAvgDev() [1/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 1430 of file Vector.h.

References pcl::StableAvgDev().

◆ StableAvgDev() [2/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 1395 of file Vector.h.

References pcl::StableAvgDev().

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

References pcl::StableMean().

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

References pcl::StableModulus().

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

References pcl::StableSum().

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

References pcl::StableSumOfSquares().

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

References pcl::StdDev().

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

References pcl::Sum().

Referenced by pcl::GenericChebyshevFit< Tx, Ty >::NumberOfTruncatedCoefficients().

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

References pcl::SumOfSquares().

◆ 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, ',' );
S & ToSeparated(S &s, SP separator) const
Definition: Vector.h:2286

Definition at line 2355 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 2286 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 2326 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 2369 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 2119 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 2139 of file Vector.h.

References pcl::TwoPi().

◆ 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 2383 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 388 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 366 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 1313 of file Vector.h.

References pcl::TrimmedMean().

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

References pcl::TrimmedMeanOfSquares().

◆ TwoSidedAvgDev() [1/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 1451 of file Vector.h.

References pcl::TwoSidedAvgDev().

◆ TwoSidedAvgDev() [2/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 1441 of file Vector.h.

References pcl::TwoSidedAvgDev().

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

References pcl::TwoSidedBiweightMidvariance().

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

References pcl::Median(), pcl::TwoSidedBiweightMidvariance(), and pcl::TwoSidedMAD().

◆ TwoSidedMAD() [1/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 1503 of file Vector.h.

References pcl::TwoSidedMAD().

◆ TwoSidedMAD() [2/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 1493 of file Vector.h.

References pcl::TwoSidedMAD().

◆ 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 929 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 1335 of file Vector.h.

References pcl::Variance().

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


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