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

typedef elementblock_iterator
 
typedef const elementconst_block_iterator
 
typedef T element
 
typedef GenericVector< elementvector
 

Public Member Functions

 GenericMatrix ()
 
 GenericMatrix (int rows, int cols)
 
 GenericMatrix (const element &x, int rows, int cols)
 
template<typename T1 >
 GenericMatrix (const T1 *a, int rows, int cols)
 
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)
 
 GenericMatrix (const GenericMatrix &x)
 
 GenericMatrix (GenericMatrix &&x)
 
 GenericMatrix (const GenericMatrix &x, int i0, int j0, int rows, int cols)
 
template<class P >
 GenericMatrix (const GenericImage< P > &image, const Rect &rect=Rect(0), int channel=-1)
 
 GenericMatrix (const ImageVariant &image, const Rect &rect=Rect(0), int channel=-1)
 
virtual ~GenericMatrix ()
 
GenericMatrix Abs () const
 
void Assign (const GenericMatrix &x)
 
double AvgDev (double center) const
 
double AvgDev () const
 
block_iterator Begin ()
 
const_block_iterator Begin () const
 
block_iterator begin ()
 
const_block_iterator begin () const
 
double BendMidvariance (double center, double beta=0.2) const
 
double BendMidvariance (double beta=0.2) const
 
double BiweightMidvariance (double center, double sigma, int k=9, bool reducedLength=false) const
 
double BiweightMidvariance (int k=9, bool reducedLength=false) const
 
void Clear ()
 
int Cols () const
 
int Columns () const
 
vector ColumnVector (int j) const
 
vector ColVector (int j) const
 
const_block_iterator ConstBegin () const
 
const_block_iterator ConstEnd () const
 
bool Contains (const element &x) const
 
block_iteratorDataPtr ()
 
elementElement (int i, int j)
 
const elementElement (int i, int j) const
 
block_iterator End ()
 
const_block_iterator End () const
 
block_iterator end ()
 
const_block_iterator end () const
 
void EnsureUnique ()
 
const_block_iterator Find (const element &x) const
 
const_block_iterator FindFirst (const element &x) const
 
const_block_iterator FindLast (const element &x) const
 
void Flip ()
 
GenericMatrix Flipped () const
 
uint64 Hash (uint64 seed=0) const
 
uint32 Hash32 (uint32 seed=0) const
 
uint64 Hash64 (uint64 seed=0) const
 
GenericMatrix Inverse () const
 
void Invert ()
 
bool IsAliasOf (const GenericMatrix &x) const
 
bool IsEmpty () const
 
bool IsUnique () const
 
bool IsValid () const
 
double MAD (double center) const
 
double MAD () const
 
element MaxElement () const
 
element MaxElement (Point &p) const
 
double Mean () const
 
double Median () const
 
element MinElement () const
 
element MinElement (Point &p) const
 
double Modulus () const
 
size_type NumberOfElements () const
 
 operator bool () const
 
block_iterator operator* ()
 
const_block_iterator operator* () const
 
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
 
GenericMatrixoperator= (const GenericMatrix &x)
 
GenericMatrixoperator= (GenericMatrix &&x)
 
GenericMatrixoperator= (const element &x)
 
bool operator== (const GenericMatrix &x) const
 
block_iterator operator[] (int i)
 
const_block_iterator operator[] (int i) const
 
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 sphi, double cphi) const
 
GenericMatrix RotatedX (double phi) const
 
GenericMatrix RotatedY (double sphi, double cphi) const
 
GenericMatrix RotatedY (double phi) const
 
GenericMatrix RotatedZ (double sphi, double cphi) const
 
GenericMatrix RotatedZ (double phi) const
 
void RotateX (double sphi, double cphi)
 
void RotateX (double phi)
 
void RotateY (double sphi, double cphi)
 
void RotateY (double phi)
 
void RotateZ (double sphi, double cphi)
 
void RotateZ (double phi)
 
block_iterator RowPtr (int i)
 
int Rows () const
 
vector RowVector (int i) const
 
bool SameDimensions (const GenericMatrix &x) const
 
bool SameElements (const GenericMatrix &x) const
 
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
 
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 (double center) const
 
double StableAvgDev () const
 
double StableMean () const
 
double StableModulus () const
 
double StableSum () const
 
double StableSumOfSquares () const
 
double StdDev () const
 
double Sum () const
 
double SumOfSquares () const
 
template<class S >
S & ToCommaSeparated (S &s) const
 
template<class 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)
 
GenericMatrix Transpose () const
 
double TrimmedMean (distance_type l=1, distance_type h=1) const
 
double TrimmedMeanOfSquares (distance_type l=1, distance_type h=1) const
 
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 (double center) const
 
TwoSidedEstimate TwoSidedAvgDev () const
 
TwoSidedEstimate TwoSidedBiweightMidvariance (double center, const TwoSidedEstimate &sigma, int k=9, bool reducedLength=false) const
 
TwoSidedEstimate TwoSidedBiweightMidvariance (int k=9, bool reducedLength=false) const
 
TwoSidedEstimate TwoSidedMAD (double center) const
 
TwoSidedEstimate TwoSidedMAD () const
 
double Variance () const
 

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 UnitMatrix (int n)
 

Friends

void Swap (GenericMatrix &x1, GenericMatrix &x2)
 

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 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>
typedef element* pcl::GenericMatrix< T >::block_iterator

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>
typedef const element* pcl::GenericMatrix< T >::const_block_iterator

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>
typedef T pcl::GenericMatrix< T >::element

Represents a matrix element.

Definition at line 129 of file Matrix.h.

◆ vector

template<typename T>
typedef GenericVector<element> pcl::GenericMatrix< T >::vector

Represents a vector of matrix elements.

Definition at line 134 of file Matrix.h.

Constructor & Destructor Documentation

◆ GenericMatrix() [1/10]

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

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

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 180 of file Matrix.h.

◆ GenericMatrix() [4/10]

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 200 of file Matrix.h.

◆ GenericMatrix() [5/10]

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 223 of file Matrix.h.

◆ GenericMatrix() [6/10]

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 238 of file Matrix.h.

◆ GenericMatrix() [7/10]

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

Move constructor.

Definition at line 247 of file Matrix.h.

◆ GenericMatrix() [8/10]

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 275 of file Matrix.h.

◆ GenericMatrix() [9/10]

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 326 of file Matrix.h.

◆ GenericMatrix() [10/10]

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 346 of file Matrix.h.

◆ ~GenericMatrix()

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

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

Definition at line 359 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 831 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 414 of file Matrix.h.

◆ AvgDev() [1/2]

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

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 2097 of file Matrix.h.

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

◆ 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 1109 of file Matrix.h.

Referenced by pcl::GenericMatrix< coefficient >::operator==().

◆ Begin() [2/2]

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

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 1124 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 1242 of file Matrix.h.

◆ begin() [2/2]

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

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

Definition at line 1250 of file Matrix.h.

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

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

◆ BiweightMidvariance() [1/2]

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

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 2265 of file Matrix.h.

◆ 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 2299 of file Matrix.h.

◆ Clear()

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

Deallocates matrix data, yielding an empty matrix.

Definition at line 371 of file Matrix.h.

◆ Cols()

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

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

Definition at line 918 of file Matrix.h.

Referenced by pcl::GenericMatrix< coefficient >::GenericMatrix(), pcl::KernelFilter::operator=(), and pcl::GenericMatrix< coefficient >::SameDimensions().

◆ Columns()

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

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 929 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 1286 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 1299 of file Matrix.h.

◆ ConstBegin()

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

A synonym for Begin() const.

Definition at line 1132 of file Matrix.h.

◆ ConstEnd()

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

A synonym for End() const.

Definition at line 1195 of file Matrix.h.

◆ Contains()

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

Returns true iff this matrix contains the specified value x.

Definition at line 1875 of file Matrix.h.

◆ DataPtr()

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

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 1218 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 1056 of file Matrix.h.

◆ Element() [2/2]

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

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

Definition at line 1066 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 1171 of file Matrix.h.

Referenced by pcl::GenericMatrix< coefficient >::operator==().

◆ End() [2/2]

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

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 1187 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 1258 of file Matrix.h.

◆ end() [2/2]

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

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

Definition at line 1266 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 894 of file Matrix.h.

◆ Find()

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

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

Definition at line 1846 of file Matrix.h.

◆ FindFirst()

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

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

Definition at line 1857 of file Matrix.h.

◆ FindLast()

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

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

Definition at line 1866 of file Matrix.h.

◆ 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 1434 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 1444 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 1358 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 1369 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 2741 of file Matrix.h.

◆ 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 2787 of file Matrix.h.

◆ 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 1345 of file Matrix.h.

◆ Hash()

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

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

Definition at line 2473 of file Matrix.h.

◆ Hash32()

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

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 2464 of file Matrix.h.

◆ Hash64()

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

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 2451 of file Matrix.h.

◆ Inverse()

template<typename T >
GenericMatrix< T > pcl::GenericMatrix< T >::Inverse ( ) const
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 2979 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 3005 of file Matrix.h.

◆ IsAliasOf()

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

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

Definition at line 882 of file Matrix.h.

◆ IsEmpty()

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

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

Definition at line 958 of file Matrix.h.

Referenced by pcl::KernelFilter::operator=().

◆ IsUnique()

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

Returns true iff this instance uniquely references its matrix data.

Definition at line 873 of file Matrix.h.

◆ IsValid()

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

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 949 of file Matrix.h.

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

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

◆ MaxElement() [1/2]

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

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

Definition at line 1917 of file Matrix.h.

◆ MaxElement() [2/2]

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

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 1930 of file Matrix.h.

◆ Mean()

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

Returns the mean of the element values in this matrix.

For empty matrices, this function returns zero.

Definition at line 2012 of file Matrix.h.

◆ 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 2078 of file Matrix.h.

◆ MinElement() [1/2]

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

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

Definition at line 1886 of file Matrix.h.

◆ MinElement() [2/2]

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

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 1899 of file Matrix.h.

◆ Modulus()

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

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

For empty matrices, this function returns zero.

Definition at line 1970 of file Matrix.h.

◆ NumberOfElements()

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

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

Definition at line 977 of file Matrix.h.

Referenced by pcl::GenericMatrix< coefficient >::SameElements().

◆ operator bool()

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

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

!IsEmpty();

Definition at line 968 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 1143 of file Matrix.h.

◆ operator*() [2/2]

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

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 1154 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 554 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 676 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 528 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 642 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 541 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 659 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 567 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 693 of file Matrix.h.

◆ operator<()

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

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 1012 of file Matrix.h.

◆ operator=() [1/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 396 of file Matrix.h.

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

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

◆ operator==()

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

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 998 of file Matrix.h.

◆ 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 1080 of file Matrix.h.

◆ operator[]() [2/2]

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

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 1092 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 580 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 709 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 2435 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 1740 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 1772 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 1801 of file Matrix.h.

◆ ReverseSorted()

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

Returns a reverse sorted copy of this matrix.

Definition at line 1811 of file Matrix.h.

◆ RotatedX() [1/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 1513 of file Matrix.h.

◆ RotatedX() [2/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 1524 of file Matrix.h.

◆ RotatedY() [1/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 1593 of file Matrix.h.

◆ RotatedY() [2/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 1604 of file Matrix.h.

◆ RotatedZ() [1/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 1673 of file Matrix.h.

◆ RotatedZ() [2/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 1684 of file Matrix.h.

◆ RotateX() [1/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 1474 of file Matrix.h.

◆ RotateX() [2/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 ) )

Definition at line 1501 of file Matrix.h.

◆ RotateY() [1/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 1554 of file Matrix.h.

◆ RotateY() [2/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 ) )

Definition at line 1581 of file Matrix.h.

◆ RotateZ() [1/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 1634 of file Matrix.h.

◆ RotateZ() [2/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 ) )

Definition at line 1661 of file Matrix.h.

◆ RowPtr()

template<typename T>
block_iterator pcl::GenericMatrix< T >::RowPtr ( 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.

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 1233 of file Matrix.h.

◆ Rows()

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

◆ 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 1275 of file Matrix.h.

◆ SameDimensions()

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

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 1021 of file Matrix.h.

◆ SameElements()

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

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 1035 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 848 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 1335 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 1321 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 1309 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 760 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 804 of file Matrix.h.

◆ Size()

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

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

Definition at line 986 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 2409 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 1782 of file Matrix.h.

◆ 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 1824 of file Matrix.h.

◆ Sorted() [1/2]

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

Returns a sorted copy of this matrix.

Definition at line 1791 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 1835 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 743 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 787 of file Matrix.h.

◆ StableAvgDev() [1/2]

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

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

When the median of the 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 2117 of file Matrix.h.

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

◆ StableMean()

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

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 2023 of file Matrix.h.

◆ StableModulus()

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

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

◆ StableSum()

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

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 1960 of file Matrix.h.

◆ StableSumOfSquares()

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

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 2002 of file Matrix.h.

◆ StdDev()

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

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 2068 of file Matrix.h.

◆ Sum()

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

Returns the sum of all matrix elements.

For empty matrices, this function returns zero.

Definition at line 1949 of file Matrix.h.

◆ SumOfSquares()

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

Returns the sum of the squares of all matrix elements.

For empty matrices, this function returns zero.

Definition at line 1991 of file Matrix.h.

◆ 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, ',' );

Definition at line 2564 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 2648 of file Matrix.h.

◆ 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 2673 of file Matrix.h.

◆ 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 2495 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 2535 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 2578 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 2592 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 442 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 461 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 1394 of file Matrix.h.

◆ TrimmedMean()

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

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 2035 of file Matrix.h.

◆ TrimmedMeanOfSquares()

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

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 2047 of file Matrix.h.

◆ 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 1703 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 1718 of file Matrix.h.

◆ TwoSidedAvgDev() [1/2]

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

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

See AvgDev( double ) for more information.

Definition at line 2163 of file Matrix.h.

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

◆ TwoSidedBiweightMidvariance() [1/2]

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

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 2319 of file Matrix.h.

◆ 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 2331 of file Matrix.h.

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

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

◆ UnitMatrix()

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

Returns a unit matrix of size n.

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

Definition at line 1380 of file Matrix.h.

◆ Variance()

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

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 2057 of file Matrix.h.

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 474 of file Matrix.h.


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