Matrix template for a 2D array of type T.
More...
#include <creos/messages/generic.hpp>
|
| Matrix ()=default |
| Default constructor.
|
|
| Matrix (const std::array< std::array< T, n_cols >, n_rows > &data) |
| Constructor from 2D array.
|
|
| Matrix (const std::array< T, n_rows *n_cols > &array) |
| Constructor from 1D array.
|
|
| Matrix (std::initializer_list< T > init) |
| Constructor from initializer list.
|
|
| Matrix (std::initializer_list< std::initializer_list< T > > init) |
| Constructor from initializer list of initializer lists.
|
|
template<typename U > |
| Matrix (const std::array< U, n_rows *n_cols > &array) |
| Transform constructor from another type of array.
|
|
std::array< T, n_rows *n_cols > | toArray () const |
| Convert the matrix to a 1D array.
|
|
template<typename U > |
std::array< U, n_rows *n_cols > | transformToArray () const |
| Transform the matrix to another type of array.
|
|
std::array< T, n_cols > & | operator[] (std::size_t index) |
| Access the elements of the matrix.
|
|
const std::array< T, n_cols > & | operator[] (std::size_t index) const |
| Access the elements of the matrix.
|
|
auto | operator<=> (const Matrix &other) const =default |
| Compare two Matrix messages.
|
|
auto | begin () const |
| Returns a constant iterator to the beginning of the matrix.
|
|
auto | end () const |
| Returns a constant iterator to the end of the matrix.
|
|
template<typename T, std::size_t n_rows, std::size_t n_cols>
class creos_messages::Matrix< T, n_rows, n_cols >
Matrix template for a 2D array of type T.
◆ Matrix() [1/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
Default constructor.
Initializes the matrix with zeros
◆ Matrix() [2/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
creos_messages::Matrix< T, n_rows, n_cols >::Matrix |
( |
const std::array< std::array< T, n_cols >, n_rows > & | data | ) |
|
|
inline |
Constructor from 2D array.
- Parameters
-
data | The 2D array to initialize the matrix with |
◆ Matrix() [3/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
Constructor from 1D array.
- Parameters
-
array | The 1D array to initialize the matrix with |
◆ Matrix() [4/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
Constructor from initializer list.
- Parameters
-
init | The initializer list to initialize the matrix with |
◆ Matrix() [5/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
creos_messages::Matrix< T, n_rows, n_cols >::Matrix |
( |
std::initializer_list< std::initializer_list< T > > | init | ) |
|
|
inline |
Constructor from initializer list of initializer lists.
- Parameters
-
init | The initializer list of initializer lists to initialize the matrix with |
◆ Matrix() [6/6]
template<typename T , std::size_t n_rows, std::size_t n_cols>
template<typename U >
Transform constructor from another type of array.
- Template Parameters
-
U | The type of the input array |
- Parameters
-
array | The array to initialize the matrix with |
◆ begin()
template<typename T , std::size_t n_rows, std::size_t n_cols>
Returns a constant iterator to the beginning of the matrix.
- Returns
- Constant iterator to the beginning of the matrix
◆ end()
template<typename T , std::size_t n_rows, std::size_t n_cols>
Returns a constant iterator to the end of the matrix.
- Returns
- Constant iterator to the end of the matrix
◆ operator[]() [1/2]
template<typename T , std::size_t n_rows, std::size_t n_cols>
Access the elements of the matrix.
- Parameters
-
index | The index of the row |
- Returns
- The row of the matrix
◆ operator[]() [2/2]
template<typename T , std::size_t n_rows, std::size_t n_cols>
const std::array< T, n_cols > & creos_messages::Matrix< T, n_rows, n_cols >::operator[] |
( |
std::size_t | index | ) |
const |
|
inline |
Access the elements of the matrix.
- Parameters
-
index | The index of the row |
- Returns
- The row of the matrix
◆ toArray()
template<typename T , std::size_t n_rows, std::size_t n_cols>
Convert the matrix to a 1D array.
- Returns
- The 1D array representation of the matrix
The documentation for this class was generated from the following file: