GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
载入中...
搜索中...
未找到
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.hpp 第 25 行定义.

Public 成员函数

constexpr Matrix ()
 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 Matrix & operator= (const Matrix &mat)
 Copy assignment of the matrix(row * size) instance
 
constexpr Matrix & operator= (Matrix &&mat) noexcept
 
constexpr Matrix & operator+= (const Matrix &mat)
 Additional operator of two matrices(row * size)
 
constexpr Matrix & operator-= (const Matrix &mat)
 Substraction operator of two matrices(row * size)
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix & operator*= (Ty val)
 Scalar operator of the matrix and a scaling factor
 
template<typename Ty >
requires (std::is_arithmetic_v<Ty>)
constexpr Matrix & operator/= (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, _rows, T > trans () const
 Get the transpose of the matrix
 
constexpr Matrix clone () const
 
constexpr T trace () 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 (const Matrix< _rows, 1, T > &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 ( )
inlineconstexpr

Constructor without input data

参数

在文件 Matrix.hpp 第 36 行定义.

◆ Matrix() [2/6]

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

在文件 Matrix.hpp 第 38 行定义.

◆ 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.hpp 第 48 行定义.

◆ 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.hpp 第 59 行定义.

◆ 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.hpp 第 64 行定义.

◆ 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.hpp 第 71 行定义.

成员函数说明

◆ 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.hpp 第 310 行定义.

◆ 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.hpp 第 358 行定义.

◆ 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.hpp 第 334 行定义.

◆ 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.hpp 第 96 行定义.

◆ diag()

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

Returns a _rows x _cols diagonal matrix

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

在文件 Matrix.hpp 第 493 行定义.

引用了 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.hpp 第 476 行定义.

引用了 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.hpp 第 383 行定义.

引用了 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.hpp 第 465 行定义.

◆ 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.hpp 第 237 行定义.

◆ 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.hpp 第 170 行定义.

◆ 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.hpp 第 203 行定义.

◆ 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.hpp 第 138 行定义.

◆ 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.hpp 第 219 行定义.

◆ 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.hpp 第 153 行定义.

◆ 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.hpp 第 270 行定义.

◆ 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.hpp 第 188 行定义.

◆ 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.hpp 第 120 行定义.

◆ 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.hpp 第 126 行定义.

◆ 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.hpp 第 304 行定义.

◆ 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.hpp 第 105 行定义.

◆ 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.hpp 第 110 行定义.

◆ 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.hpp 第 324 行定义.

◆ 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.hpp 第 87 行定义.

◆ 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.hpp 第 370 行定义.

◆ trans()

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

Get the transpose of the matrix

参数

retval the transposed matrix

在文件 Matrix.hpp 第 344 行定义.

被这些函数引用 roboctrl::utils::RLS< dim >::update().

◆ 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.hpp 第 454 行定义.

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

友元及相关函数文档

◆ Matrix

template<int _rows, int _cols, typename T = float>
template<int r, int c, typename U >
friend class Matrix
friend

在文件 Matrix.hpp 第 29 行定义.

◆ 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.hpp 第 287 行定义.

◆ 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.hpp 第 256 行定义.


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