GKD.RoboCtrl
载入中...
搜索中...
未找到
roboctrl::utils::Matrix< _rows, _cols, T > 模板类 参考

详细描述

template<int _rows, int _cols, typename T = float>
requires (std::is_arithmetic_v<T> && _rows > 0 && _cols > 0)
class roboctrl::utils::Matrix< _rows, _cols, T >

在文件 Matrix.hpp23 行定义.

Public 成员函数

constexpr Matrix ()=default
 Constructor without input data
 
constexpr Matrix (T val)
 
constexpr Matrix (const T *data)
 Constructor with input data
 
constexpr Matrix (const Matrix &mat)
 Copy Constructor
 
constexpr Matrix (Matrix &&mat) noexcept
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix (const Matrix< _rows, _cols, Ty > &mat)
 
 ~Matrix ()=default
 Destructor
 
constexpr uint32_t rows () const
 returns the row size of the matrix
 
constexpr uint32_t cols () const
 return the column size of the matrix
 
constexpr std::array< T, _cols > & operator[] (int row)
 Return the element of the matrix
 
constexpr const std::array< T, _cols > & operator[] (int row) const
 
constexpr Matrixoperator= (const Matrix &mat)
 Copy assignment of the matrix(row * size) instance
 
constexpr Matrixoperator= (Matrix &&mat) noexcept
 
constexpr Matrixoperator+= (const Matrix &mat)
 Additional operator of two matrices(row * size)
 
constexpr Matrixoperator-= (const Matrix &mat)
 Substraction operator of two matrices(row * size)
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrixoperator*= (Ty val)
 Scalar operator of the matrix and a scaling factor
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrixoperator/= (Ty val)
 Scalar operator of the matrix and a division factor
 
constexpr Matrix operator+ (const Matrix &mat) const
 Additonal operator
 
constexpr Matrix operator- (const Matrix &mat) const
 Substraction matrix
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix operator* (Ty val) const
 Scalar operator of the matrix and a scaling factor
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
Matrix operator/ (Ty val) const
 Scalar operator of the matrix and a division factor
 
constexpr bool operator== (const Matrix &mat) const
 Compare whether two matrices are identical
 
template<int rows, int cols>
constexpr Matrix< rows, cols, T > block (int start_row, int start_col) const
 
constexpr Matrix< 1, _cols, T > row (int row) const
 Return the specific row of the matrix
 
constexpr Matrix< _rows, 1, T > col (int col) const
 Return the specific row of the matrix
 
constexpr Matrix< _cols, _rowstrans () const
 Get the transpose of the matrix
 
constexpr Matrix clone () const
 
constexprtrace () const
 Get the trace of the matrix
 
constexpr Matrix inv () const
 Get the inverse of the matrix
 

静态 Public 成员函数

static constexpr Matrix zeros ()
 Returns a _rows x _cols zero matrix
 
static constexpr Matrix ones ()
 Returns a _rows x _cols one matrix
 
static constexpr Matrix eye ()
 Returns a _rows * columns matrix
 
static constexpr Matrix diag (Matrix< _rows, 1 > vec)
 Returns a _rows x _cols diagonal matrix
 

友元

template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr friend Matrix operator* (Ty val, const Matrix &mat)
 Scalar operator of the matrix and a scaling factor
 
template<int cols2>
constexpr friend Matrix< _rows, cols2, T > operator* (const Matrix< _rows, _cols, T > &mat1, const Matrix< _cols, cols2, T > &mat2)
 The matrix multiplication
 

构造及析构函数说明

◆ Matrix() [1/6]

template<int _rows, int _cols, typename T = float>
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( )
constexprdefault

Constructor without input data

参数

◆ Matrix() [2/6]

template<int _rows, int _cols, typename T = float>
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( val)
inlineexplicitconstexpr

在文件 Matrix.hpp33 行定义.

◆ Matrix() [3/6]

template<int _rows, int _cols, typename T = float>
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( const T *  data)
inlineexplicitconstexpr

Constructor with input data

参数
dataA 2-D array buffer that stores the data

在文件 Matrix.hpp43 行定义.

◆ Matrix() [4/6]

template<int _rows, int _cols, typename T = float>
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( const Matrix< _rows, _cols, T > &  mat)
inlineconstexpr

Copy Constructor

参数
matThe copied matrix

在文件 Matrix.hpp54 行定义.

◆ Matrix() [5/6]

template<int _rows, int _cols, typename T = float>
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( Matrix< _rows, _cols, T > &&  mat)
inlineconstexprnoexcept

在文件 Matrix.hpp59 行定义.

◆ Matrix() [6/6]

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr roboctrl::utils::Matrix< _rows, _cols, T >::Matrix ( const Matrix< _rows, _cols, Ty > &  mat)
inlineconstexpr

在文件 Matrix.hpp66 行定义.

成员函数说明

◆ block()

template<int _rows, int _cols, typename T = float>
template<int rows, int cols>
constexpr Matrix< rows, cols, T > roboctrl::utils::Matrix< _rows, _cols, T >::block ( int  start_row,
int  start_col 
) const
inlineconstexpr

在文件 Matrix.hpp305 行定义.

◆ clone()

template<int _rows, int _cols, typename T = float>
constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::clone ( ) const
inlineconstexpr

Clone the matrix

返回
the clone of the matrix

在文件 Matrix.hpp353 行定义.

◆ col()

template<int _rows, int _cols, typename T = float>
constexpr Matrix< _rows, 1, T > roboctrl::utils::Matrix< _rows, _cols, T >::col ( int  col) const
inlineconstexpr

Return the specific row of the matrix

参数
colThe column index
返回值
Thecolumn vector presented in the matrix from

在文件 Matrix.hpp329 行定义.

◆ cols()

template<int _rows, int _cols, typename T = float>
constexpr uint32_t roboctrl::utils::Matrix< _rows, _cols, T >::cols ( ) const
inlineconstexpr

return the column size of the matrix

返回
_cols The column size of the matrix

在文件 Matrix.hpp91 行定义.

◆ diag()

template<int _rows, int _cols, typename T = float>
static constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::diag ( Matrix< _rows, 1 >  vec)
inlinestaticconstexpr

Returns a _rows x _cols diagonal matrix

模板参数
_rowsThe row size
_colsThe column size
参数
vecThe diagnoal entries
返回值
Thediagnoanl matrix

在文件 Matrix.hpp468 行定义.

引用了 roboctrl::utils::Matrix< _rows, _cols, T >::zeros().

◆ eye()

template<int _rows, int _cols, typename T = float>
static constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::eye ( )
inlinestaticconstexpr

Returns a _rows * columns matrix

模板参数
_rowsThe row size
_colsThe column size
返回值
Theidentity matrix

在文件 Matrix.hpp451 行定义.

引用了 roboctrl::utils::Matrix< _rows, _cols, T >::zeros().

被这些函数引用 roboctrl::utils::Matrix< _rows, _cols, T >::inv() , 以及 roboctrl::utils::RLS< dim >::reset().

◆ inv()

template<int _rows, int _cols, typename T = float>
constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::inv ( ) const
inlineconstexpr

Get the inverse of the matrix

参数

retval The inverse of the matrix

在文件 Matrix.hpp378 行定义.

引用了 roboctrl::utils::Matrix< _rows, _cols, T >::eye().

◆ ones()

template<int _rows, int _cols, typename T = float>
static constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::ones ( )
inlinestaticconstexpr

Returns a _rows x _cols one matrix

模板参数
_rowsThe row size
_colsThe column size
返回值
Theone matrix

在文件 Matrix.hpp440 行定义.

◆ operator*()

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::operator* ( Ty  val) const
inlineconstexpr

Scalar operator of the matrix and a scaling factor

参数
valThe scaling factor
注解
This function does not return itself
返回
THe scaled matrix

在文件 Matrix.hpp232 行定义.

◆ operator*=()

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator*= ( Ty  val)
inlineconstexpr

Scalar operator of the matrix and a scaling factor

参数
valThe scaling factor
注解
This function returns itself as the result
返回
THe scaled matrix

在文件 Matrix.hpp165 行定义.

◆ operator+()

template<int _rows, int _cols, typename T = float>
constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::operator+ ( const Matrix< _rows, _cols, T > &  mat) const
inlineconstexpr

Additonal operator

注解
This function doesn't return itself but instead a new matrix instance
参数
matThe matrix on the right hand side
返回
The sum of the additional matrix

在文件 Matrix.hpp198 行定义.

◆ operator+=()

template<int _rows, int _cols, typename T = float>
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator+= ( const Matrix< _rows, _cols, T > &  mat)
inlineconstexpr

Additional operator of two matrices(row * size)

参数
matThe matrix on the right hand side
注解
This function returns itself as the result
返回
The sum of two matrices

在文件 Matrix.hpp133 行定义.

◆ operator-()

template<int _rows, int _cols, typename T = float>
constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::operator- ( const Matrix< _rows, _cols, T > &  mat) const
inlineconstexpr

Substraction matrix

注解
This function does not return itself but instead a new matrix instance
参数
matmatrix on the right hand side
返回
The sum of the substracted matrix

在文件 Matrix.hpp214 行定义.

◆ operator-=()

template<int _rows, int _cols, typename T = float>
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator-= ( const Matrix< _rows, _cols, T > &  mat)
inlineconstexpr

Substraction operator of two matrices(row * size)

参数
matThe matrix on the left hand side
注解
This function returns itself as the result
返回
The difference of two matrices

在文件 Matrix.hpp148 行定义.

◆ operator/()

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
Matrix roboctrl::utils::Matrix< _rows, _cols, T >::operator/ ( Ty  val) const
inline

Scalar operator of the matrix and a division factor

参数
valThe division factor
注解
This function returns itself as the result
返回值
matrix/ val
返回
The scaled matrix

在文件 Matrix.hpp265 行定义.

◆ operator/=()

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator/= ( Ty  val)
inlineconstexpr

Scalar operator of the matrix and a division factor

参数
valThe division factor
注解
This function returns itself as the result
返回值
matrix/ val
返回
The scaled matrix

在文件 Matrix.hpp183 行定义.

◆ operator=() [1/2]

template<int _rows, int _cols, typename T = float>
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator= ( const Matrix< _rows, _cols, T > &  mat)
inlineconstexpr

Copy assignment of the matrix(row * size) instance

参数
matThe copied prototype
返回
*this matrix

在文件 Matrix.hpp115 行定义.

◆ operator=() [2/2]

template<int _rows, int _cols, typename T = float>
constexpr Matrix & roboctrl::utils::Matrix< _rows, _cols, T >::operator= ( Matrix< _rows, _cols, T > &&  mat)
inlineconstexprnoexcept

在文件 Matrix.hpp121 行定义.

◆ operator==()

template<int _rows, int _cols, typename T = float>
constexpr bool roboctrl::utils::Matrix< _rows, _cols, T >::operator== ( const Matrix< _rows, _cols, T > &  mat) const
inlineconstexpr

Compare whether two matrices are identical

在文件 Matrix.hpp299 行定义.

◆ operator[]() [1/2]

template<int _rows, int _cols, typename T = float>
constexpr std::array< T, _cols > & roboctrl::utils::Matrix< _rows, _cols, T >::operator[] ( int  row)
inlineconstexpr

Return the element of the matrix

参数
rowThe row

在文件 Matrix.hpp100 行定义.

◆ operator[]() [2/2]

template<int _rows, int _cols, typename T = float>
constexpr const std::array< T, _cols > & roboctrl::utils::Matrix< _rows, _cols, T >::operator[] ( int  row) const
inlineconstexpr

在文件 Matrix.hpp105 行定义.

◆ row()

template<int _rows, int _cols, typename T = float>
constexpr Matrix< 1, _cols, T > roboctrl::utils::Matrix< _rows, _cols, T >::row ( int  row) const
inlineconstexpr

Return the specific row of the matrix

参数
rowThe row index
返回值
Therow vector presented in the matrix from

在文件 Matrix.hpp319 行定义.

◆ rows()

template<int _rows, int _cols, typename T = float>
constexpr uint32_t roboctrl::utils::Matrix< _rows, _cols, T >::rows ( ) const
inlineconstexpr

returns the row size of the matrix

返回
_rows The row size of the matrix

在文件 Matrix.hpp82 行定义.

◆ trace()

template<int _rows, int _cols, typename T = float>
constexpr T roboctrl::utils::Matrix< _rows, _cols, T >::trace ( ) const
inlineconstexpr

Get the trace of the matrix

参数

retval The trace of the matrix

在文件 Matrix.hpp365 行定义.

◆ trans()

template<int _rows, int _cols, typename T = float>
constexpr Matrix< _cols, _rows > roboctrl::utils::Matrix< _rows, _cols, T >::trans ( ) const
inlineconstexpr

Get the transpose of the matrix

参数

retval the transposed matrix

在文件 Matrix.hpp339 行定义.

◆ zeros()

template<int _rows, int _cols, typename T = float>
static constexpr Matrix roboctrl::utils::Matrix< _rows, _cols, T >::zeros ( )
inlinestaticconstexpr

Returns a _rows x _cols zero matrix

模板参数
_rowsThe row size
_colsThe column size
返回值
Thezero matrix

在文件 Matrix.hpp429 行定义.

被这些函数引用 roboctrl::utils::Matrix< _rows, _cols, T >::diag(), roboctrl::utils::Matrix< _rows, _cols, T >::eye() , 以及 roboctrl::utils::RLS< dim >::reset().

友元及相关函数文档

◆ operator* [1/2]

template<int _rows, int _cols, typename T = float>
template<int cols2>
constexpr friend Matrix< _rows, cols2, T > operator* ( const Matrix< _rows, _cols, T > &  mat1,
const Matrix< _cols, cols2, T > &  mat2 
)
friend

The matrix multiplication

参数
mat1the matrix on the LHS
mat2the matrix on the RHS
返回
The multiplication result

在文件 Matrix.hpp282 行定义.

◆ operator* [2/2]

template<int _rows, int _cols, typename T = float>
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr friend Matrix operator* ( Ty  val,
const Matrix< _rows, _cols, T > &  mat 
)
friend

Scalar operator of the matrix and a scaling factor

参数
valThe scaling factor on the left hand side
注解
This function does not return itself
This time the scaling factor is on the left hand side
返回
THe scaled matrix

在文件 Matrix.hpp251 行定义.


该类的文档由以下文件生成: