PCL
pcl::GenericMatrix< T > Class Template Reference

Generic dynamic matrix of arbitrary dimensions. More...

#include <Matrix.h>

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

Public Types

using block_iterator = element *
 
using const_block_iterator = const element *
 
using element = T
 
using vector = GenericVector< element >
 

Public Member Functions

 GenericMatrix ()
 
 GenericMatrix (const element &x, int rows, int cols)
 
template<class P >
 GenericMatrix (const GenericImage< P > &image, const Rect &rect=Rect(0), int channel=-1)
 
 GenericMatrix (const GenericMatrix &x)
 
 GenericMatrix (const GenericMatrix &x, int i0, int j0, int rows, int cols)
 
 GenericMatrix (const ImageVariant &image, const Rect &rect=Rect(0), int channel=-1)
 
template<typename T1 >
 GenericMatrix (const T1 &a00, const T1 &a01, const T1 &a02, const T1 &a10, const T1 &a11, const T1 &a12, const T1 &a20, const T1 &a21, const T1 &a22)
 
template<typename T1 >
 GenericMatrix (const T1 &a00, const T1 &a01, const T1 &a10, const T1 &a11)
 
template<typename T1 >
 GenericMatrix (const T1 *a, int rows, int cols)
 
 GenericMatrix (GenericMatrix &&x)
 
 GenericMatrix (int rows, int cols)
 
virtual ~GenericMatrix ()
 
GenericMatrix Abs () const
 
void Assign (const GenericMatrix &x)
 
double AvgDev () const
 
double AvgDev (double center) const noexcept
 
block_iterator Begin ()
 
block_iterator begin ()
 
const_block_iterator Begin () const noexcept
 
const_block_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 ()
 
int Cols () const noexcept
 
int Columns () const noexcept
 
vector ColumnVector (int j) const
 
vector ColVector (int j) const
 
const_block_iterator ConstBegin () const noexcept
 
const_block_iterator ConstEnd () const noexcept
 
bool Contains (const element &x) const noexcept
 
block_iteratorDataPtr () noexcept
 
elementElement (int i, int j)
 
const elementElement (int i, int j) const noexcept
 
block_iterator End ()
 
block_iterator end ()
 
const_block_iterator End () const noexcept
 
const_block_iterator end () const noexcept
 
void EnsureUnique ()
 
const_block_iterator Find (const element &x) const noexcept
 
const_block_iterator FindFirst (const element &x) const noexcept
 
const_block_iterator FindLast (const element &x) const noexcept
 
void Flip ()
 
GenericMatrix Flipped () const
 
uint64 Hash (uint64 seed=0) const noexcept
 
uint32 Hash32 (uint32 seed=0) const noexcept
 
uint64 Hash64 (uint64 seed=0) const noexcept
 
GenericMatrix Inverse () const
 
void Invert ()
 
bool IsAliasOf (const GenericMatrix &x) const noexcept
 
bool IsEmpty () const noexcept
 
bool IsUnique () const noexcept
 
bool IsValid () const noexcept
 
double MAD () const
 
double MAD (double center) const
 
element MaxElement () const noexcept
 
element MaxElement (Point &p) const noexcept
 
double Mean () const noexcept
 
double Median () const
 
element MinElement () const noexcept
 
element MinElement (Point &p) const noexcept
 
double Modulus () const noexcept
 
size_type NumberOfElements () const noexcept
 
 operator bool () const noexcept
 
block_iterator operator* ()
 
const_block_iterator operator* () const noexcept
 
GenericMatrixoperator*= (const element &x)
 
GenericMatrixoperator*= (const GenericMatrix &x)
 
GenericMatrixoperator+= (const element &x)
 
GenericMatrixoperator+= (const GenericMatrix &x)
 
GenericMatrixoperator-= (const element &x)
 
GenericMatrixoperator-= (const GenericMatrix &x)
 
GenericMatrixoperator/= (const element &x)
 
GenericMatrixoperator/= (const GenericMatrix &x)
 
bool operator< (const GenericMatrix &x) const noexcept
 
GenericMatrixoperator= (const element &x)
 
GenericMatrixoperator= (const GenericMatrix &x)
 
GenericMatrixoperator= (GenericMatrix &&x)
 
bool operator== (const GenericMatrix &x) const noexcept
 
block_iterator operator[] (int i)
 
const_block_iterator operator[] (int i) const noexcept
 
GenericMatrixoperator^= (const element &x)
 
GenericMatrixoperator^= (const GenericMatrix &x)
 
double Qn () const
 
void Rescale (const element &f0=element(0), const element &f1=element(1))
 
GenericMatrix Rescaled (const element &f0=element(0), const element &f1=element(1)) const
 
void ReverseSort ()
 
GenericMatrix ReverseSorted () const
 
GenericMatrix RotatedX (double phi) const
 
GenericMatrix RotatedX (double sphi, double cphi) const
 
GenericMatrix RotatedY (double phi) const
 
GenericMatrix RotatedY (double sphi, double cphi) const
 
GenericMatrix RotatedZ (double phi) const
 
GenericMatrix RotatedZ (double sphi, double cphi) const
 
void RotateX (double phi)
 
void RotateX (double sphi, double cphi)
 
void RotateY (double phi)
 
void RotateY (double sphi, double cphi)
 
void RotateZ (double phi)
 
void RotateZ (double sphi, double cphi)
 
block_iterator RowPtr (int i) noexcept
 
int Rows () const noexcept
 
vector RowVector (int i) const
 
bool SameDimensions (const GenericMatrix &x) const noexcept
 
bool SameElements (const GenericMatrix &x) const noexcept
 
void SetAbs ()
 
template<class V >
void SetCol (int j, const V &c)
 
template<class V >
void SetColumn (int j, const V &c)
 
template<class V >
void SetRow (int i, const V &r)
 
void SetSqr ()
 
void SetSqrt ()
 
size_type Size () const noexcept
 
double Sn () const
 
void Sort ()
 
template<class BP >
void Sort (BP p)
 
GenericMatrix Sorted () const
 
template<class BP >
GenericMatrix Sorted (BP p) const
 
GenericMatrix Sqr () const
 
GenericMatrix 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 P >
void ToImage (GenericImage< P > &image) const
 
void ToImage (ImageVariant &image) 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<class S >
S & ToTabSeparated (S &s) const
 
void Transfer (GenericMatrix &&x)
 
void Transfer (GenericMatrix &x)
 
template<class V >
void Translate (const V &delta)
 
void Translate (double dx, double dy)
 
template<class V >
GenericMatrix Translated (const V &delta) const
 
GenericMatrix Translated (double dx, double dy) const
 
GenericMatrix Transpose () const
 
double TrimmedMean (distance_type l=1, distance_type h=1) const noexcept
 
double TrimmedMeanOfSquares (distance_type l=1, distance_type h=1) const noexcept
 
void Truncate (const element &f0=element(0), const element &f1=element(1))
 
GenericMatrix Truncated (const element &f0=element(0), const element &f1=element(1)) const
 
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
 
double Variance () const noexcept
 

Static Public Member Functions

static GenericMatrix CrossPowerSpectrumMatrix (const GenericMatrix &A, const GenericMatrix &B)
 
static GenericMatrix FromColumnVector (const vector &c)
 
static GenericMatrix FromColVector (const vector &c)
 
template<class P >
static GenericMatrix FromImage (const GenericImage< P > &image, const Rect &rect=Rect(0), int channel=-1)
 
static GenericMatrix FromImage (const ImageVariant &image, const Rect &rect=Rect(0), int channel=-1)
 
static GenericMatrix FromRowVector (const vector &r)
 
static GenericMatrix PhaseCorrelationMatrix (const GenericMatrix &A, const GenericMatrix &B)
 
static GenericMatrix RotationX (double phi)
 
static GenericMatrix RotationX (double sphi, double cphi)
 
static GenericMatrix RotationY (double phi)
 
static GenericMatrix RotationY (double sphi, double cphi)
 
static GenericMatrix RotationZ (double phi)
 
static GenericMatrix RotationZ (double sphi, double cphi)
 
template<class V >
static GenericMatrix Translation (const V &delta)
 
static GenericMatrix Translation (double dx, double dy)
 
static GenericMatrix UnitMatrix (int n)
 

Friends

void Swap (GenericMatrix &x1, GenericMatrix &x2) noexcept
 

Detailed Description

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

GenericMatrix is a lightweight template class implementing a matrix of arbitrary size. This class provides the following main features:

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

Definition at line 122 of file Matrix.h.

Member Typedef Documentation

◆ block_iterator

template<typename T >
using pcl::GenericMatrix< T >::block_iterator = element*

Represents a mutable matrix block iterator. In a matrix of n rows and m columns, a block iterator allows iteration on the entire set of matrix elements from {0,0} to {n-1,m-1} in row-column order.

Definition at line 141 of file Matrix.h.

◆ const_block_iterator

template<typename T >
using pcl::GenericMatrix< T >::const_block_iterator = const element*

Represents an immutable matrix block iterator. In a matrix of n rows and m columns, a block iterator allows iteration on the entire set of matrix elements from {0,0} to {n-1,m-1} in row-column order.

Definition at line 148 of file Matrix.h.

◆ element

template<typename T >
using pcl::GenericMatrix< T >::element = T

Represents a matrix element.

Definition at line 129 of file Matrix.h.

◆ vector

template<typename T >
using pcl::GenericMatrix< T >::vector = GenericVector<element>

Represents a vector of matrix elements.

Definition at line 134 of file Matrix.h.

Constructor & Destructor Documentation

◆ GenericMatrix() [1/11]

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

Constructs an empty matrix. An empty matrix has no elements and zero dimensions.

Definition at line 154 of file Matrix.h.

◆ GenericMatrix() [2/11]

template<typename T >
pcl::GenericMatrix< T >::GenericMatrix ( int  rows,
int  cols 
)
inline

Constructs an uninitialized matrix.

Parameters
rowsNumber of matrix rows (≥ 0).
colsNumber of matrix columns (≥ 0).

Matrix elements are not initialized by this constructor; the newly created matrix will contain unpredictable values.

Definition at line 168 of file Matrix.h.

◆ GenericMatrix() [3/11]

template<typename T >
pcl::GenericMatrix< T >::GenericMatrix ( const element x,
int  rows,
int  cols 
)
inline

Constructs a matrix and fills it with a constant value.

Parameters
xInitial value for all matrix elements.
rowsNumber of matrix rows (≥ 0).
colsNumber of matrix columns (≥ 0).

Definition at line 181 of file Matrix.h.

◆ GenericMatrix() [4/11]

template<typename T >
template<typename T1 >
pcl::GenericMatrix< T >::GenericMatrix ( const T1 *  a,
int  rows,
int  cols 
)
inline

Constructs a matrix and initializes it with values from a static buffer.

Parameters
aAddress of the first item of a static array for initialization of matrix elements. The array must provide at least rows x cols consecutive elements stored in row order (all elements of the first matrix row followed by all elements of the second row, and so on).
rowsNumber of matrix rows (≥ 0).
colsNumber of matrix columns (≥ 0).

Definition at line 202 of file Matrix.h.

◆ GenericMatrix() [5/11]

template<typename T >
template<typename T1 >
pcl::GenericMatrix< T >::GenericMatrix ( const T1 &  a00,
const T1 &  a01,
const T1 &  a10,
const T1 &  a11 
)
inline

Constructs a 2x2 matrix initialized with the specified element values.

The resulting square matrix will be initialized as follows:

a00, a01
a10, a11

Definition at line 228 of file Matrix.h.

◆ GenericMatrix() [6/11]

template<typename T >
template<typename T1 >
pcl::GenericMatrix< T >::GenericMatrix ( const T1 &  a00,
const T1 &  a01,
const T1 &  a02,
const T1 &  a10,
const T1 &  a11,
const T1 &  a12,
const T1 &  a20,
const T1 &  a21,
const T1 &  a22 
)
inline

Constructs a 3x3 matrix initialized with the specified element values.

The resulting square matrix will be initialized as follows:

a00, a01, a02
a10, a11, a12
a20, a21, a22

Definition at line 249 of file Matrix.h.

◆ GenericMatrix() [7/11]

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

Copy constructor. This object will reference the same data that is being referenced by the specified matrix x.

Definition at line 264 of file Matrix.h.

◆ GenericMatrix() [8/11]

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

Move constructor.

Definition at line 273 of file Matrix.h.

◆ GenericMatrix() [9/11]

template<typename T >
pcl::GenericMatrix< T >::GenericMatrix ( const GenericMatrix< T > &  x,
int  i0,
int  j0,
int  rows,
int  cols 
)
inline

Constructs a matrix as a copy of a rectangular subset of another matrix.

Parameters
xSource matrix from which this object will acquire element values.
i0Starting row in x. Corresponds to the first (top) row of this matrix.
j0Starting column in x. Corresponds to the first (leftmost) column of this matrix.
rowsNumber of matrix rows.
colsNumber of matrix columns.

If the specified submatrix is invalid, i.e. if the specified row or column don't exist, or if the specified number of rows and columns exceed the dimensions of the source matrix x, this constructor constrains the submatrix coordinates and dimensions to the nearest valid values, possibly constructing an empty matrix.

Definition at line 301 of file Matrix.h.

References pcl::GenericMatrix< T >::Cols(), pcl::Max(), pcl::Range(), and pcl::GenericMatrix< T >::Rows().

◆ GenericMatrix() [10/11]

template<typename T >
template<class P >
pcl::GenericMatrix< T >::GenericMatrix ( const GenericImage< P > &  image,
const Rect rect = Rect( 0 ),
int  channel = -1 
)
inline

Constructs a matrix from image pixel samples.

This constructor converts pixel sample values to matrix elements for a rectangular region of a channel of the specified image.

Parameters
imageImage from which matrix elements will be generated.
rectA rectangular region in image pixel coordinates, from which this matrix will be generated. If this parameter is not specified, or if an empty rectangle is specified, this function will perform the matrix conversion for the current rectangular selection in the image, that is, for image.SelectedRectangle().
channelChannel index. Must be the zero-based index of an existing channel in the image, or an integer < 0. If this parameter is not specified, or if a negative integer is specified, this function will perform the matrix conversion for the currently selected channel in the image, that is, for image.SelectedChannel().

The newly created matrix is a representation of the intersection of the specified (or implicitly selected) rectangular region with the image for the scalar data type T of this matrix instantiation. All predefined pixel sample types are supported, including integer, real and complex pixels.

If there is no intersection between the rectangular region and the image, this constructor yields an empty matrix.

Note that if the source image is of a floating point type (either real or complex) and the scalar type T of this matrix instantiation is of an integer type, out-of-range matrix elements will be truncated to either zero or to the maximum integer value, if the corresponding source pixel sample is outside the normalized [0,1] range.

Definition at line 352 of file Matrix.h.

◆ GenericMatrix() [11/11]

template<typename T >
pcl::GenericMatrix< T >::GenericMatrix ( const ImageVariant image,
const Rect rect = Rect( 0 ),
int  channel = -1 
)
inline

Constructs a matrix from image pixel samples.

This constructor converts pixel sample values to matrix elements for a rectangular region of a channel of the image transported by the specified ImageVariant.

If the specified ImageVariant object does not transport an image, this constructor yields an empty matrix.

Refer to the documentation for GenericMatrix::GenericMatrix( const GenericImage&, const Rect&, int ) for more information about the conversion performed by this constructor.

Definition at line 372 of file Matrix.h.

◆ ~GenericMatrix()

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

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

Definition at line 384 of file Matrix.h.

Member Function Documentation

◆ Abs()

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

Returns the absolute value of this matrix. The result is a new matrix of the same dimensions where each element is the absolute value of its counterpart in this matrix.

Definition at line 874 of file Matrix.h.

◆ Assign()

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

Assigns a matrix x to this object.

If this instance and the specified source instance x reference different matrix 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 matrix data, then this function does nothing.

Definition at line 439 of file Matrix.h.

◆ AvgDev() [1/2]

template<typename T >
double pcl::GenericMatrix< 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 matrices with less than two elements, 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 2442 of file Matrix.h.

References pcl::AvgDev().

◆ AvgDev() [2/2]

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

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

When the median of the matrix 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 matrices with less than two elements, 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 2405 of file Matrix.h.

References pcl::AvgDev().

◆ Begin() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::Begin ( )
inline

Returns a pointer to the first matrix element, that is to the element at row 0 and column 0 of this matrix.

All matrix elements are guaranteed to be stored at consecutive locations addressable from the pointer returned by this function. Matrix elements are stored in row order: all elements of row 0 followed by all elements of row 1, and so on.

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

Definition at line 1161 of file Matrix.h.

◆ begin() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::begin ( )
inline

STL-compatible iteration. Equivalent to Begin().

Definition at line 1294 of file Matrix.h.

◆ Begin() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::Begin ( ) const
inlinenoexcept

Returns a pointer to the immutable first matrix element, that is to the element at row 0 and column 0 of this matrix.

All matrix elements are guaranteed to be stored at consecutive locations addressable from the pointer returned by this function. Matrix elements are stored in row order: all elements of row 0 followed by all elements of row 1, and so on.

Definition at line 1176 of file Matrix.h.

◆ begin() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::begin ( ) const
inlinenoexcept

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

Definition at line 1302 of file Matrix.h.

◆ BendMidvariance() [1/2]

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

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

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

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

For matrices with less than two elements, this function returns zero.

References

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

Definition at line 2691 of file Matrix.h.

References pcl::BendMidvariance().

◆ BendMidvariance() [2/2]

template<typename T >
double pcl::GenericMatrix< 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 matrix elements should be used.
betaRejection parameter in the [0,0.5] range. Higher values improve robustness to outliers (i.e., increase the breakdown point of the estimator) at the expense of lower efficiency. The default value is beta=0.2.

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

For matrices with less than two elements, 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 2667 of file Matrix.h.

References pcl::BendMidvariance().

◆ BiweightMidvariance() [1/2]

template<typename T >
double pcl::GenericMatrix< 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 matrix elements should be used.
sigmaA reference estimate of dispersion. Normally, the median absolute deviation from the median (MAD) of the matrix elements should be used.
kRejection limit in sigma units. The default value is k=9.
reducedLengthIf true, reduce the sample size to exclude rejected matrix elements. 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 number of matrix elements, including rejected elements, 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 matrices with less than two elements, 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 2573 of file Matrix.h.

References pcl::BiweightMidvariance().

◆ BiweightMidvariance() [2/2]

template<typename T >
double pcl::GenericMatrix< 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 matrix elements. 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 number of matrix elements, including rejected elements, 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 matrices with less than two elements, 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 2607 of file Matrix.h.

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

◆ Clear()

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

Deallocates matrix data, yielding an empty matrix.

Definition at line 396 of file Matrix.h.

◆ Cols()

template<typename T >
int pcl::GenericMatrix< T >::Cols ( ) const
inlinenoexcept

Returns the number of columns in this matrix. If this object is an empty matrix, this member function returns zero.

Definition at line 969 of file Matrix.h.

Referenced by pcl::GenericMatrix< T >::GenericMatrix().

◆ Columns()

template<typename T >
int pcl::GenericMatrix< T >::Columns ( ) const
inlinenoexcept

Returns the number of columns in this matrix. If this object is an empty matrix, this member function returns zero.

This function is a synonym for Cols().

Definition at line 980 of file Matrix.h.

◆ ColumnVector()

template<typename T >
vector pcl::GenericMatrix< T >::ColumnVector ( int  j) const
inline

Returns a vector with the matrix elements at the specified column j.

Definition at line 1338 of file Matrix.h.

◆ ColVector()

template<typename T >
vector pcl::GenericMatrix< T >::ColVector ( int  j) const
inline

Returns a vector with the matrix elements at the specified column j.

This member function is an alias for ColumnVector().

Definition at line 1351 of file Matrix.h.

◆ ConstBegin()

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::ConstBegin ( ) const
inlinenoexcept

A synonym for Begin() const.

Definition at line 1184 of file Matrix.h.

◆ ConstEnd()

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::ConstEnd ( ) const
inlinenoexcept

A synonym for End() const.

Definition at line 1247 of file Matrix.h.

◆ Contains()

template<typename T >
bool pcl::GenericMatrix< T >::Contains ( const element x) const
inlinenoexcept

Returns true iff this matrix contains the specified value x.

Definition at line 2183 of file Matrix.h.

References pcl::LinearSearch().

◆ DataPtr()

template<typename T >
block_iterator* pcl::GenericMatrix< T >::DataPtr ( )
inlinenoexcept

Returns a pointer to a pointer to the first element in this matrix.

The returned pointer can be used as a common C array, where all matrix rows are guaranteed to be addressable through consecutive pointers starting from the pointer returned by this function.

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

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

Definition at line 1270 of file Matrix.h.

◆ Element() [1/2]

template<typename T >
element& pcl::GenericMatrix< T >::Element ( int  i,
int  j 
)
inline

Returns a reference to the matrix element at row i and column j.

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

Definition at line 1108 of file Matrix.h.

◆ Element() [2/2]

template<typename T >
const element& pcl::GenericMatrix< T >::Element ( int  i,
int  j 
) const
inlinenoexcept

Returns a reference to the immutable matrix element at row i and column j.

Definition at line 1118 of file Matrix.h.

◆ End() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::End ( )
inline

Returns a pointer past the last matrix element, that is a pointer to an (nonexistent) element located at row=Rows()-1 and column=Cols().

All matrix elements are guaranteed to be stored in reverse order at consecutive locations addressable from the pointer returned by this function. Matrix elements are stored in row order (all elements of row n followed by all elements of row n-1, and so on).

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

Definition at line 1223 of file Matrix.h.

◆ end() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::end ( )
inline

STL-compatible iteration. Equivalent to End().

Definition at line 1310 of file Matrix.h.

◆ End() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::End ( ) const
inlinenoexcept

Returns a pointer past the last immutable matrix element, that is a pointer to an immutable (and nonexistent) element located at row=Rows()-1 and column=Cols().

All matrix elements are guaranteed to be stored in reverse order at consecutive locations addressable from the pointer returned by this function. Matrix elements are stored in row order (all elements of row n followed by all elements of row n-1, and so on).

Definition at line 1239 of file Matrix.h.

◆ end() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::end ( ) const
inlinenoexcept

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

Definition at line 1318 of file Matrix.h.

◆ EnsureUnique()

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

Ensures that this instance uniquely references its matrix data.

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

Definition at line 940 of file Matrix.h.

◆ Find()

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::Find ( const element x) const
inlinenoexcept

Returns a pointer to the first immutable matrix element with the specified value x, or nullptr if this matrix does not contain such value.

Definition at line 2154 of file Matrix.h.

References pcl::LinearSearch().

◆ FindFirst()

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::FindFirst ( const element x) const
inlinenoexcept

Returns a pointer to the first immutable matrix element with the specified value x, or nullptr if this matrix does not contain such value. This function is an alias to Find().

Definition at line 2165 of file Matrix.h.

◆ FindLast()

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::FindLast ( const element x) const
inlinenoexcept

Returns a pointer to the last immutable matrix element with the specified value x, or nullptr if this matrix does not contain such value.

Definition at line 2174 of file Matrix.h.

References pcl::LinearSearchLast().

◆ Flip()

template<typename T >
void pcl::GenericMatrix< T >::Flip ( )
inline

Flips this matrix. Flipping a matrix consists of rotating its elements by 180 degrees.

This function ensures that this instance uniquely references its matrix data before performing matrix rotation.

Definition at line 1486 of file Matrix.h.

◆ Flipped()

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::Flipped ( ) const
inline

Returns a flipped copy of this matrix. Flipping a matrix consists of rotating its elements by 180 degrees.

Definition at line 1496 of file Matrix.h.

◆ FromColumnVector()

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::FromColumnVector ( const vector c)
inlinestatic

Returns a matrix whose first column is a copy of the specified vector c. The rest of matrix elements are set to zero. The returned object is a square matrix whose dimensions are equal to the length of c.

Definition at line 1410 of file Matrix.h.

◆ FromColVector()

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::FromColVector ( const vector c)
inlinestatic

This member function is an alias for FromColumnVector().

Definition at line 1421 of file Matrix.h.

◆ FromImage() [1/2]

template<typename T >
template<class P >
static GenericMatrix pcl::GenericMatrix< T >::FromImage ( const GenericImage< P > &  image,
const Rect rect = Rect( 0 ),
int  channel = -1 
)
inlinestatic

Creates a matrix from image pixel samples.

This static member function converts pixel sample values to matrix elements for a rectangular region of a channel of the specified image.

Parameters
imageImage from which matrix elements will be generated.
rectA rectangular region in image pixel coordinates, from which the returned matrix will be generated. If this parameter is not specified, or if an empty rectangle is specified, this function will perform the matrix conversion for the current rectangular selection in the image, that is, for image.SelectedRectangle().
channelChannel index. Must be the zero-based index of an existing channel in the image, or an integer < 0. If this parameter is not specified, or if a negative integer is specified, this function will perform the matrix conversion for the currently selected channel in the image, that is, for image.SelectedChannel().

The returned matrix is a representation of the intersection of the specified (or implicitly selected) rectangular region with the image for the scalar data type T of this matrix instantiation. All predefined pixel sample types are supported, including integer, real and complex pixels.

If there is no intersection between the rectangular region and the image, or if an invalid channel index is specified, this function returns an empty matrix.

Note that if the source image is of a floating point type (either real or complex) and the scalar type T of this matrix instantiation is of an integer type, out-of-range matrix elements will be truncated to either zero or to the maximum integer value, if the corresponding source pixel sample is outside the normalized [0,1] range.

Definition at line 3054 of file Matrix.h.

References pcl::ImageGeometry::Bounds(), and pcl::AbstractImage::ParseSelection().

◆ FromImage() [2/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::FromImage ( const ImageVariant image,
const Rect rect = Rect( 0 ),
int  channel = -1 
)
inlinestatic

Creates a matrix from image pixel samples.

This static member function converts pixel sample values to matrix elements for a rectangular region of a channel of the image transported by the specified ImageVariant.

If the specified ImageVariant object does not transport an image, this member function returns an empty matrix.

Refer to the documentation for FromImage( const GenericImage&, const Rect&, int ) for more information about the conversion performed by this member function.

Definition at line 3103 of file Matrix.h.

References pcl::ImageVariant::BitsPerSample(), pcl::ImageVariant::IsComplexSample(), and pcl::ImageVariant::IsFloatSample().

◆ FromRowVector()

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::FromRowVector ( const vector r)
inlinestatic

Returns a matrix whose first row is a copy of the specified vector r. The rest of matrix elements are set to zero. The returned object is a square matrix whose dimensions are equal to the length of r.

Definition at line 1397 of file Matrix.h.

◆ Hash()

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

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

Definition at line 2785 of file Matrix.h.

References pcl::Hash64().

◆ Hash32()

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

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

This function calls pcl::Hash32() for the internal matrix 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 2776 of file Matrix.h.

References pcl::Hash32().

◆ Hash64()

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

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

This function calls pcl::Hash64() for the internal matrix 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 2763 of file Matrix.h.

References pcl::Hash64().

◆ Inverse()

template<typename T >
GenericMatrix< T > pcl::GenericMatrix< T >::Inverse
inline

Returns the inverse of this matrix.

When a square matrix is multiplied by its inverse, the result is the identity matrix. Non-square matrices do not have inverses.

If this is an empty or non-square matrix, or if it is singular (i.e. if its determinant is zero or insignificant), then this function throws the appropriate Error exception.

Definition at line 3313 of file Matrix.h.

◆ Invert()

template<typename T >
void pcl::GenericMatrix< T >::Invert
inline

Inverts this matrix.

When a square matrix is multiplied by its inverse, the result is the identity matrix. Non-square matrices do not have inverses.

If this is an empty or non-square matrix, or if it is singular (i.e. if its determinant is zero or insignificant), then this function throws the appropriate Error exception.

Definition at line 3339 of file Matrix.h.

◆ IsAliasOf()

template<typename T >
bool pcl::GenericMatrix< T >::IsAliasOf ( const GenericMatrix< T > &  x) const
inlinenoexcept

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

Definition at line 928 of file Matrix.h.

◆ IsEmpty()

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

Returns true iff this is an empty matrix. An empty matrix has no elements, and hence its dimensions are zero.

Definition at line 1009 of file Matrix.h.

◆ IsUnique()

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

Returns true iff this instance uniquely references its matrix data.

Definition at line 919 of file Matrix.h.

◆ IsValid()

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

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

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

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

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

Definition at line 1000 of file Matrix.h.

◆ MAD() [1/2]

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

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

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

For matrices with less than two elements, 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 2512 of file Matrix.h.

References pcl::MAD().

◆ MAD() [2/2]

template<typename T >
double pcl::GenericMatrix< 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 matrices with less than two elements, 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 2497 of file Matrix.h.

References pcl::MAD().

◆ MaxElement() [1/2]

template<typename T >
element pcl::GenericMatrix< T >::MaxElement ( ) const
inlinenoexcept

Returns the value of the maximum element in this matrix. For empty matrices, this function returns zero.

Definition at line 2225 of file Matrix.h.

References pcl::MaxItem().

◆ MaxElement() [2/2]

template<typename T >
element pcl::GenericMatrix< T >::MaxElement ( Point p) const
inlinenoexcept

Returns the value of the maximum element in this matrix and its coordinates in the specified point p. For empty matrices, this function returns zero and assigns zero to the point coordinates.

Definition at line 2238 of file Matrix.h.

References pcl::MaxItem().

◆ Mean()

template<typename T >
double pcl::GenericMatrix< T >::Mean ( ) const
inlinenoexcept

Returns the mean of the element values in this matrix.

For empty matrices, this function returns zero.

Definition at line 2320 of file Matrix.h.

References pcl::Mean().

◆ Median()

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

Returns the median of element values in this matrix.

For matrices with less than two elements, this function returns zero.

Definition at line 2386 of file Matrix.h.

References pcl::Median().

◆ MinElement() [1/2]

template<typename T >
element pcl::GenericMatrix< T >::MinElement ( ) const
inlinenoexcept

Returns the value of the minimum element in this matrix. For empty matrices, this function returns zero.

Definition at line 2194 of file Matrix.h.

References pcl::MinItem().

◆ MinElement() [2/2]

template<typename T >
element pcl::GenericMatrix< T >::MinElement ( Point p) const
inlinenoexcept

Returns the value of the minimum element in this matrix and its coordinates in the specified point p. For empty matrices, this function returns zero and assigns zero to the point coordinates.

Definition at line 2207 of file Matrix.h.

References pcl::MinItem().

◆ Modulus()

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

Returns the sum of the absolute values of all matrix elements.

For empty matrices, this function returns zero.

Definition at line 2278 of file Matrix.h.

References pcl::Modulus().

◆ NumberOfElements()

template<typename T >
size_type pcl::GenericMatrix< T >::NumberOfElements ( ) const
inlinenoexcept

Returns the total number of matrix elements in this object, or Rows()*Cols().

Definition at line 1028 of file Matrix.h.

◆ operator bool()

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

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

!IsEmpty();
bool IsEmpty() const noexcept
Definition: Matrix.h:1009

Definition at line 1019 of file Matrix.h.

◆ operator*() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::operator* ( )
inline

Returns a pointer to the first matrix element, that is to the element at row 0 and column 0 of this matrix.

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

Definition at line 1195 of file Matrix.h.

◆ operator*() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::operator* ( ) const
inlinenoexcept

Returns a pointer to the immutable first matrix element, that is to the element at row 0 and column 0 of this matrix.

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

Definition at line 1206 of file Matrix.h.

◆ operator*=() [1/2]

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

Multiplies all elements of this matrix by a constant scalar x. Returns a reference to this object.

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

Definition at line 581 of file Matrix.h.

◆ operator*=() [2/2]

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

Performs the element-wise multiplication of a matrix x with this matrix. Returns a reference to this object.

The specified operand matrix x should have at least the same number of elements as this matrix. Otherwise the operation will be aborted upon reaching the end of the operand matrix, but no exception will be thrown.

This function ensures that this instance uniquely references its matrix data before the element-wise multiplication operation, generating a duplicate if necessary.

Definition at line 709 of file Matrix.h.

◆ operator+=() [1/2]

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

Adds a constant scalar x to all elements of this matrix. Returns a reference to this object.

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

Definition at line 555 of file Matrix.h.

◆ operator+=() [2/2]

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

Performs the element-wise addition of a matrix x to this matrix. Returns a reference to this object.

The specified operand matrix x should have at least the same number of elements as this matrix. Otherwise the operation will be aborted upon reaching the end of the operand matrix, but no exception will be thrown.

This function ensures that this instance uniquely references its matrix data before the element-wise addition operation, generating a duplicate if necessary.

Definition at line 675 of file Matrix.h.

◆ operator-=() [1/2]

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

Subtracts a constant scalar x from all elements of this matrix. Returns a reference to this object.

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

Definition at line 568 of file Matrix.h.

◆ operator-=() [2/2]

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

Performs the element-wise subtraction of a matrix x to this matrix. Returns a reference to this object.

The specified operand matrix x should have at least the same number of elements as this matrix. Otherwise the operation will be aborted upon reaching the end of the operand matrix, but no exception will be thrown.

This function ensures that this instance uniquely references its matrix data before the element-wise subtraction operation, generating a duplicate if necessary.

Definition at line 692 of file Matrix.h.

◆ operator/=() [1/2]

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

Divides all elements of this matrix by a constant scalar x. Returns a reference to this object.

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

Definition at line 594 of file Matrix.h.

◆ operator/=() [2/2]

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

Performs the element-wise division of this matrix by a matrix x. Returns a reference to this object.

The specified operand matrix x should have at least the same number of elements as this matrix. Otherwise the operation will be aborted upon reaching the end of the operand matrix, but no exception will be thrown.

This function ensures that this instance uniquely references its matrix data before the element-wise division operation, generating a duplicate if necessary.

Definition at line 726 of file Matrix.h.

◆ operator<()

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

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

In this operator, matrix comparisons are performed element-wise, irrespective of matrix dimensions, until either two matrix elements differ, or until the end of one of the matrices is reached. In the latter case the shortest matrix is the lesser one.

Definition at line 1063 of file Matrix.h.

References pcl::Compare().

◆ operator=() [1/3]

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

Assigns a constant scalar x to all elements of this matrix. Returns a reference to this object.

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

Definition at line 512 of file Matrix.h.

◆ operator=() [2/3]

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

Copy assignment operator. Returns a reference to this object.

If this instance and the specified source instance x reference different matrix 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 matrix data, then this function does nothing.

Definition at line 421 of file Matrix.h.

◆ operator=() [3/3]

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

Move assignment operator. Returns a reference to this object.

Definition at line 449 of file Matrix.h.

◆ operator==()

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

Equality operator. Returns true if this matrix is equal to another matrix x.

Matrix comparisons are performed element-wise. Two matrices are equal if both have the same dimensions and identical element values.

Definition at line 1049 of file Matrix.h.

References pcl::Equal().

◆ operator[]() [1/2]

template<typename T >
block_iterator pcl::GenericMatrix< T >::operator[] ( int  i)
inline

Returns a pointer to the first matrix element of row i.

All elements in row i are guaranteed to be stored at consecutive locations addressable from the pointer returned by this function.

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

Definition at line 1132 of file Matrix.h.

◆ operator[]() [2/2]

template<typename T >
const_block_iterator pcl::GenericMatrix< T >::operator[] ( int  i) const
inlinenoexcept

Returns a pointer to the immutable first matrix element of row i.

All elements in row i are guaranteed to be stored at consecutive locations addressable from the pointer returned by this function.

Definition at line 1144 of file Matrix.h.

◆ operator^=() [1/2]

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

Raises all elements of this matrix to a constant scalar x. Returns a reference to this object.

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

Definition at line 607 of file Matrix.h.

◆ operator^=() [2/2]

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

Performs the element-wise exponentiation of this matrix by a matrix x. Returns a reference to this object.

The specified matrix x must have at least the same number of elements as this matrix. Otherwise an Error exception will be thrown.

This function ensures that this instance uniquely references its matrix data before the element-wise raise operation, generating a duplicate if necessary.

Definition at line 742 of file Matrix.h.

◆ Qn()

template<typename T >
double pcl::GenericMatrix< 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 matrices with less than two elements, 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 2747 of file Matrix.h.

◆ Rescale()

template<typename T >
void pcl::GenericMatrix< T >::Rescale ( const element f0 = element( 0 ),
const element f1 = element( 1 ) 
)
inline

Rescales all matrix elements to the specified range.

Parameters
f0Lower bound of the rescaling range. If not specified, the default value is zero.
f1Upper bound of the rescaling range. If not specified, the default value is one.

The rescaling operation is as follows. if m and M are the minimum and maximum element values in this matrix, respectively, then for each matrix element s, its rescaled value r is given by:

r = f0 + (s - m)*(f1 - f0)/(M - m)

Definition at line 2041 of file Matrix.h.

◆ Rescaled()

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::Rescaled ( const element f0 = element( 0 ),
const element f1 = element( 1 ) 
) const
inline

Returns a rescaled copy of this matrix. See Rescale().

Definition at line 2079 of file Matrix.h.

◆ ReverseSort()

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

Sorts the elements of this matrix in reverse (descending) order.

Definition at line 2108 of file Matrix.h.

References pcl::Sort().

◆ ReverseSorted()

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

Returns a reverse sorted copy of this matrix.

Definition at line 2118 of file Matrix.h.

◆ RotatedX() [1/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedX ( double  phi) const
inline

Returns a rotated copy of this 3x3 matrix about the X axis by the specified rotation angle phi in radians. See RotateX( double ).

Definition at line 1822 of file Matrix.h.

◆ RotatedX() [2/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedX ( double  sphi,
double  cphi 
) const
inline

Returns a rotated copy of this 3x3 matrix about the X axis by a rotation angle given by its sine sphi and cosine cphi. See RotateX( double, double ).

Definition at line 1811 of file Matrix.h.

◆ RotatedY() [1/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedY ( double  phi) const
inline

Returns a rotated copy of this 3x3 matrix about the Y axis by the specified rotation angle phi in radians. See RotateY( double ).

Definition at line 1903 of file Matrix.h.

◆ RotatedY() [2/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedY ( double  sphi,
double  cphi 
) const
inline

Returns a rotated copy of this 3x3 matrix about the Y axis by a rotation angle given by its sine sphi and cosine cphi. See RotateY( double, double ).

Definition at line 1892 of file Matrix.h.

◆ RotatedZ() [1/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedZ ( double  phi) const
inline

Returns a rotated copy of this 3x3 matrix about the Z axis by the specified rotation angle phi in radians. See RotateZ( double ).

Definition at line 1984 of file Matrix.h.

◆ RotatedZ() [2/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::RotatedZ ( double  sphi,
double  cphi 
) const
inline

Returns a rotated copy of this 3x3 matrix about the Z axis by a rotation angle given by its sine sphi and cosine cphi. See RotateZ( double, double ).

Definition at line 1973 of file Matrix.h.

◆ RotateX() [1/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateX ( double  phi)
inline

Rotates this 3x3 matrix about the X axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotateX( Sin( phi ), Cos( phi ) )
void RotateX(double sphi, double cphi)
Definition: Matrix.h:1771
Complex< T > Sin(const Complex< T > &c) noexcept
Definition: Complex.h:795
Complex< T > Cos(const Complex< T > &c) noexcept
Definition: Complex.h:806

Definition at line 1799 of file Matrix.h.

References pcl::SinCos().

◆ RotateX() [2/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateX ( double  sphi,
double  cphi 
)
inline

Rotates this 3x3 matrix about the X axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the X axis, as seen looking towards the origin from positive x. The applied transformation can be represented by the matrix:

1     0        0
0   +cphi   +sphi
0   -sphi   +cphi

If this matrix has dimensions different from 3 rows and 3 columns, this function invokes undefined behavior. For the sake of performance, this condition is not explicitly verified.

See also
RotateX( double ), RotatedX()

Definition at line 1771 of file Matrix.h.

◆ RotateY() [1/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateY ( double  phi)
inline

Rotates this 3x3 matrix about the Y axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotateY( Sin( phi ), Cos( phi ) )
void RotateY(double sphi, double cphi)
Definition: Matrix.h:1852

Definition at line 1880 of file Matrix.h.

References pcl::SinCos().

◆ RotateY() [2/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateY ( double  sphi,
double  cphi 
)
inline

Rotates this 3x3 matrix about the Y axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the Y axis, as seen looking towards the origin from positive y. The applied transformation can be represented by the matrix:

+cphi  0  -sphi
  0    1    0
+sphi  0  +cphi

If this matrix has dimensions different from 3 rows and 3 columns, this function invokes undefined behavior. For the sake of performance, this condition is not explicitly verified.

See also
RotateY( double ), RotatedY()

Definition at line 1852 of file Matrix.h.

◆ RotateZ() [1/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateZ ( double  phi)
inline

Rotates this 3x3 matrix about the Z axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotateZ( Sin( phi ), Cos( phi ) )
void RotateZ(double sphi, double cphi)
Definition: Matrix.h:1933

Definition at line 1961 of file Matrix.h.

References pcl::SinCos().

◆ RotateZ() [2/2]

template<typename T >
void pcl::GenericMatrix< T >::RotateZ ( double  sphi,
double  cphi 
)
inline

Rotates this 3x3 matrix about the Z axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the Z axis, as seen looking towards the origin from positive z. The applied transformation can be represented by the matrix:

+cphi  +sphi  0
-sphi  +cphi  0
  0      0    1

If this matrix has dimensions different from 3 rows and 3 columns, this function invokes undefined behavior. For the sake of performance, this condition is not explicitly verified.

See also
RotateZ( double ), RotatedZ()

Definition at line 1933 of file Matrix.h.

◆ RotationX() [1/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationX ( double  phi)
inlinestatic

Returns a 3x3 rotation matrix about the X axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotationX( Sin( phi ), Cos( phi ) )
static GenericMatrix RotationX(double sphi, double cphi)
Definition: Matrix.h:1642

Definition at line 1657 of file Matrix.h.

References pcl::SinCos().

◆ RotationX() [2/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationX ( double  sphi,
double  cphi 
)
inlinestatic

Returns a 3x3 rotation matrix about the X axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the X axis, as seen looking towards the origin from positive x.

The returned matrix is:

1     0       0
0   +cphi   +sphi
0   -sphi   +cphi
See also
RotationX( double )

Definition at line 1642 of file Matrix.h.

◆ RotationY() [1/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationY ( double  phi)
inlinestatic

Returns a 3x3 rotation matrix about the Y axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotationY( Sin( phi ), Cos( phi ) )
static GenericMatrix RotationY(double sphi, double cphi)
Definition: Matrix.h:1684

Definition at line 1699 of file Matrix.h.

References pcl::SinCos().

◆ RotationY() [2/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationY ( double  sphi,
double  cphi 
)
inlinestatic

Returns a 3x3 rotation matrix about the Y axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the Y axis, as seen looking towards the origin from positive y.

The returned matrix is:

+cphi  0  -sphi
  0    1    0
+sphi  0  +cphi
See also
RotationY( double )

Definition at line 1684 of file Matrix.h.

◆ RotationZ() [1/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationZ ( double  phi)
inlinestatic

Returns a 3x3 rotation matrix about the Z axis by the specified angle phi in radians.

Calling this function is equivalent to:

RotationZ( Sin( phi ), Cos( phi ) )
static GenericMatrix RotationZ(double sphi, double cphi)
Definition: Matrix.h:1726

Definition at line 1741 of file Matrix.h.

References pcl::SinCos().

◆ RotationZ() [2/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::RotationZ ( double  sphi,
double  cphi 
)
inlinestatic

Returns a 3x3 rotation matrix about the Z axis.

Parameters
sphiSine of the rotation angle.
cphiCosine of the rotation angle.

Positive rotation angles apply anticlockwise rotations about the Z axis, as seen looking towards the origin from positive z.

The returned matrix is:

+cphi  +sphi  0
-sphi  +cphi  0
  0      0    1
See also
RotationZ( double )

Definition at line 1726 of file Matrix.h.

◆ RowPtr()

template<typename T >
block_iterator pcl::GenericMatrix< T >::RowPtr ( int  i)
inlinenoexcept

Returns a pointer to the first matrix element of row i.

All elements in row i are guaranteed to be stored at consecutive locations addressable from the pointer returned by this function.

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

Definition at line 1285 of file Matrix.h.

◆ Rows()

template<typename T >
int pcl::GenericMatrix< T >::Rows ( ) const
inlinenoexcept

Returns the number of rows in this matrix. If this object is an empty matrix, this member function returns zero.

Definition at line 960 of file Matrix.h.

Referenced by pcl::GenericMatrix< T >::GenericMatrix(), pcl::GenericFFT2D< T >::operator<<(), pcl::GenericRealFFT2D< T >::operator<<(), pcl::GenericFFT2D< T >::operator>>(), and pcl::GenericRealFFT2D< T >::operator>>().

◆ RowVector()

template<typename T >
vector pcl::GenericMatrix< T >::RowVector ( int  i) const
inline

Returns a vector with the matrix elements at the specified row i.

Definition at line 1327 of file Matrix.h.

◆ SameDimensions()

template<typename T >
bool pcl::GenericMatrix< T >::SameDimensions ( const GenericMatrix< T > &  x) const
inlinenoexcept

Returns true iff this matrix has the same dimensions, i.e. the same number of rows and columns, as another matrix x.

Definition at line 1072 of file Matrix.h.

◆ SameElements()

template<typename T >
bool pcl::GenericMatrix< T >::SameElements ( const GenericMatrix< T > &  x) const
inlinenoexcept

Returns true iff this matrix has the same elements as another matrix x.

In this member function, matrix comparisons are performed element-wise, irrespective of matrix dimensions. Note that two matrices can have exactly the same elements even if their dimensions, i.e. their number of rows and columns, are different. Only the number and order of elements are relevant for this comparison.

Definition at line 1086 of file Matrix.h.

◆ SetAbs()

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

Replaces all elements of this matrix with their absolute values.

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

Definition at line 892 of file Matrix.h.

◆ SetCol()

template<typename T >
template<class V >
void pcl::GenericMatrix< T >::SetCol ( int  j,
const V &  c 
)
inline

Assigns the components of a vector c to the corresponding elements of a matrix column i.

This member function is an alias for SetColumn().

Definition at line 1387 of file Matrix.h.

◆ SetColumn()

template<typename T >
template<class V >
void pcl::GenericMatrix< T >::SetColumn ( int  j,
const V &  c 
)
inline

Assigns the components of a vector c to the corresponding elements of a matrix column i.

Definition at line 1373 of file Matrix.h.

◆ SetRow()

template<typename T >
template<class V >
void pcl::GenericMatrix< T >::SetRow ( int  i,
const V &  r 
)
inline

Assigns the components of a vector r to the corresponding elements of a matrix row i.

Definition at line 1361 of file Matrix.h.

◆ SetSqr()

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

Replaces all elements of this matrix with their squares.

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

Definition at line 798 of file Matrix.h.

◆ SetSqrt()

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

Replaces all elements of this matrix with their square roots.

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

Definition at line 845 of file Matrix.h.

◆ Size()

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

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

Definition at line 1037 of file Matrix.h.

◆ Sn()

template<typename T >
double pcl::GenericMatrix< 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 matrices with less than two elements, 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 2719 of file Matrix.h.

◆ Sort() [1/2]

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

Sorts the elements of this matrix in ascending order.

Definition at line 2089 of file Matrix.h.

References pcl::Sort().

◆ Sort() [2/2]

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

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

Definition at line 2131 of file Matrix.h.

References pcl::Sort().

◆ Sorted() [1/2]

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

Returns a sorted copy of this matrix.

Definition at line 2098 of file Matrix.h.

◆ Sorted() [2/2]

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

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

Definition at line 2142 of file Matrix.h.

◆ Sqr()

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

Returns the square of this matrix. The result is a new matrix of the same dimensions where each element is the square of its counterpart in this matrix.

Definition at line 780 of file Matrix.h.

◆ Sqrt()

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

Returns the square root of this matrix. The result is a new matrix of the same dimensions where each element is the square root of its counterpart in this matrix.

Definition at line 827 of file Matrix.h.

◆ StableAvgDev() [1/2]

template<typename T >
double pcl::GenericMatrix< 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 matrices with less than two elements, 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 2460 of file Matrix.h.

References pcl::StableAvgDev().

◆ StableAvgDev() [2/2]

template<typename T >
double pcl::GenericMatrix< 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 matrix 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 matrices with less than two elements, 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 2425 of file Matrix.h.

References pcl::StableAvgDev().

◆ StableMean()

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

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

For empty matrices, this function returns zero.

Definition at line 2331 of file Matrix.h.

References pcl::StableMean().

◆ StableModulus()

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

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

For empty matrices, this function returns zero.

Definition at line 2289 of file Matrix.h.

References pcl::StableModulus().

◆ StableSum()

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

Computes the sum of all matrix elements using a numerically stable summation algorithm to minimize roundoff error.

For empty matrices, this function returns zero.

Definition at line 2268 of file Matrix.h.

References pcl::StableSum().

◆ StableSumOfSquares()

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

Computes the sum of the squares of all matrix elements using a numerically stable summation algorithm to minimize roundoff error.

For empty matrices, this function returns zero.

Definition at line 2310 of file Matrix.h.

References pcl::StableSumOfSquares().

◆ StdDev()

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

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

For matrices with less than two elements, this function returns zero.

Definition at line 2376 of file Matrix.h.

References pcl::StdDev().

◆ Sum()

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

Returns the sum of all matrix elements.

For empty matrices, this function returns zero.

Definition at line 2257 of file Matrix.h.

References pcl::Sum().

◆ SumOfSquares()

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

Returns the sum of the squares of all matrix elements.

For empty matrices, this function returns zero.

Definition at line 2299 of file Matrix.h.

References pcl::SumOfSquares().

◆ ToCommaSeparated()

template<typename T >
template<class S >
S& pcl::GenericMatrix< 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: Matrix.h:2807

Definition at line 2876 of file Matrix.h.

◆ ToImage() [1/2]

template<typename T >
template<class P >
void pcl::GenericMatrix< T >::ToImage ( GenericImage< P > &  image) const
inline

Renders this matrix as an image.

The contents of the specified image will be replaced with a grayscale rendition of this matrix, where the value of each pixel sample will be proportional to its corresponding matrix component counterpart.

Note that if this matrix has out-of-range values for the pixel sample type of the target image, pixel saturation will occur at either the white or black points, or both. This only happens when the target image is of an integer type and this matrix contains floating point values outside the normalized [0,1] range.

If the target image is of a floating-point type (either real or complex) and this matrix also stores floating point values, the output image may require a rescaling or normalization operation to constrain all pixel values to the normalized [0,1] range after calling this member function.

Definition at line 2960 of file Matrix.h.

References pcl::GenericImage< P >::AllocateData().

◆ ToImage() [2/2]

template<typename T >
void pcl::GenericMatrix< T >::ToImage ( ImageVariant image) const
inline

Renders this matrix as an image.

The contents of the image transported by the specified ImageVariant object will be replaced with a grayscale rendition of this matrix, where the value of each pixel sample will be proportional to its corresponding matrix component counterpart.

If the specified ImageVariant does not transport an image, a new one will be created in 32-bit floating point format.

Also take into account the information given for ToImage( GenericImage& ), relative to out-of-range values, which is entirely applicable to this member function.

Definition at line 2986 of file Matrix.h.

References pcl::ImageVariant::BitsPerSample(), pcl::ImageVariant::CreateFloatImage(), pcl::ImageVariant::IsComplexSample(), and pcl::ImageVariant::IsFloatSample().

◆ ToSeparated() [1/2]

template<typename T >
template<class S , typename SP >
S& pcl::GenericMatrix< 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 matrix element, this function appends a string representation (known as a token) to the target string s. If the matrix contains more than one element, 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 matrix element 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 2807 of file Matrix.h.

◆ ToSeparated() [2/2]

template<typename T >
template<class S , typename SP , class AF >
S& pcl::GenericMatrix< 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 matrix element 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 matrix has more than one element, successive tokens are separated by calling:

append( s, S( separator ) );

The string type S must have type conversion semantics to transform a matrix element 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 2847 of file Matrix.h.

◆ ToSpaceSeparated()

template<typename T >
template<class S >
S& pcl::GenericMatrix< 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 2890 of file Matrix.h.

◆ ToTabSeparated()

template<typename T >
template<class S >
S& pcl::GenericMatrix< 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 2904 of file Matrix.h.

◆ Transfer() [1/2]

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

Transfers data from another matrix x to this object.

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

Warning
The source matrix 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 486 of file Matrix.h.

◆ Transfer() [2/2]

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

Transfers data from another matrix x to this object.

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

Warning
The source matrix 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 467 of file Matrix.h.

◆ Translate() [1/2]

template<typename T >
template<class V >
void pcl::GenericMatrix< T >::Translate ( const V &  delta)
inline

Translates this 3x3 matrix by the specified translation vector delta.

See Translation( const V& ) for detailed information on the expected properties of the type V.

See also
Translate( double, double )

Definition at line 1589 of file Matrix.h.

◆ Translate() [2/2]

template<typename T >
void pcl::GenericMatrix< T >::Translate ( double  dx,
double  dy 
)
inline

Translates this 3x3 matrix.

Parameters
dxTranslation increment on the X axis.
dyTranslation increment on the Y axis.

This function multiplies this matrix by the translation matrix:

1   0   dx
0   1   dy
0   0   1

If this matrix has dimensions different from 3 rows and 3 columns, this function invokes undefined behavior. For the sake of performance, this condition is not explicitly verified.

See also
Translation( double, double )

Definition at line 1568 of file Matrix.h.

◆ Translated() [1/2]

template<typename T >
template<class V >
GenericMatrix pcl::GenericMatrix< T >::Translated ( const V &  delta) const
inline

Returns a translated copy of this 3x3 matrix by the specified translation vector delta.

See Translation( const V& ) for detailed information on the expected properties of the type V.

See also
Translated( double, double )

Definition at line 1617 of file Matrix.h.

◆ Translated() [2/2]

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::Translated ( double  dx,
double  dy 
) const
inline

Returns a translated copy of this 3x3 matrix by the specified increments dx and dy on the X and Y axes, respectively. See Translate().

See also
Translate( double, double )

Definition at line 1600 of file Matrix.h.

◆ Translation() [1/2]

template<typename T >
template<class V >
static GenericMatrix pcl::GenericMatrix< T >::Translation ( const V &  delta)
inlinestatic

Returns a 3x3 translation matrix for the specified translation vector delta.

The type V is expected to provide the array subscript operator:

C V::operator []( int i ) const

where the type C must have conversion-to-double semantics. The subindex i will be either 0 or 1 for the translation increments on the X and Y axes, respectively.

See also
Translation( double, double )

Definition at line 1541 of file Matrix.h.

◆ Translation() [2/2]

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::Translation ( double  dx,
double  dy 
)
inlinestatic

Returns a 3x3 translation matrix.

Parameters
dxTranslation increment on the X axis.
dyTranslation increment on the Y axis.

The returned matrix is:

1   0   dx
0   1   dy
0   0   1
See also
Translate( double, double )

Definition at line 1519 of file Matrix.h.

◆ Transpose()

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::Transpose ( ) const
inline

Returns the transpose of this matrix.

The transpose of a matrix A is another matrix AT whose rows are the columns of A (or, equivalently, whose columns are the rows of A).

Definition at line 1446 of file Matrix.h.

◆ TrimmedMean()

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

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

For empty matrices, this function returns zero.

Definition at line 2343 of file Matrix.h.

References pcl::TrimmedMean().

◆ TrimmedMeanOfSquares()

template<typename T >
double pcl::GenericMatrix< 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 matrix. See pcl::TrimmedMeanOfSquares() for a complete description of the implemented algorithm with information on function parameters.

For empty matrices, this function returns zero.

Definition at line 2355 of file Matrix.h.

References pcl::TrimmedMeanOfSquares().

◆ Truncate()

template<typename T >
void pcl::GenericMatrix< T >::Truncate ( const element f0 = element( 0 ),
const element f1 = element( 1 ) 
)
inline

Truncates all matrix elements to the specified range.

Parameters
f0Lower bound of the truncation range. If not specified, the default value is zero.
f1Upper bound of the truncation range. If not specified, the default value is one.

After calling this member function, all matrix elements will be within the [f0,f1] range.

Definition at line 2003 of file Matrix.h.

◆ Truncated()

template<typename T >
GenericMatrix pcl::GenericMatrix< T >::Truncated ( const element f0 = element( 0 ),
const element f1 = element( 1 ) 
) const
inline

Returns a truncated copy of this matrix. See Truncate().

Definition at line 2019 of file Matrix.h.

◆ TwoSidedAvgDev() [1/2]

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

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

See AvgDev() for more information.

Definition at line 2481 of file Matrix.h.

References pcl::TwoSidedAvgDev().

◆ TwoSidedAvgDev() [2/2]

template<typename T >
TwoSidedEstimate pcl::GenericMatrix< 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 2471 of file Matrix.h.

References pcl::TwoSidedAvgDev().

◆ TwoSidedBiweightMidvariance() [1/2]

template<typename T >
TwoSidedEstimate pcl::GenericMatrix< 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 2627 of file Matrix.h.

References pcl::TwoSidedBiweightMidvariance().

◆ TwoSidedBiweightMidvariance() [2/2]

template<typename T >
TwoSidedEstimate pcl::GenericMatrix< 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 2639 of file Matrix.h.

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

◆ TwoSidedMAD() [1/2]

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

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

See MAD() for more information.

Definition at line 2533 of file Matrix.h.

References pcl::TwoSidedMAD().

◆ TwoSidedMAD() [2/2]

template<typename T >
TwoSidedEstimate pcl::GenericMatrix< 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 2523 of file Matrix.h.

References pcl::TwoSidedMAD().

◆ UnitMatrix()

template<typename T >
static GenericMatrix pcl::GenericMatrix< T >::UnitMatrix ( int  n)
inlinestatic

Returns a unit matrix of size n.

A unit matrix is a square matrix whose elements are ones on its main diagonal and zeros elsewhere.

Definition at line 1432 of file Matrix.h.

◆ Variance()

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

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

For matrices with less than two elements, this function returns zero.

Definition at line 2365 of file Matrix.h.

References pcl::Variance().

Friends And Related Function Documentation

◆ Swap

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

Exchanges two matrices x1 and x2.

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

Definition at line 499 of file Matrix.h.


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