HLR
0.0.1
|
Create a matrix with numerical values. More...
#include <Matrix.hpp>
Public Member Functions | |
Matrix ()=default | |
Create matrix with all elements set to 0. | |
~Matrix ()=default | |
Default destructor. | |
Matrix (const Matrix< T, m, n > &mat)=default | |
Default copy constructor. More... | |
Matrix (Matrix< T, m, n > &&mat)=default | |
Default move constructor. More... | |
Matrix< T, m, n > & | operator= (const Matrix< T, m, n > &mat)=default |
Default assignment operator. More... | |
Matrix< T, m, n > & | operator= (Matrix< T, m, n > &&mat)=default |
Default move assignment operator. More... | |
constexpr | Matrix (std::initializer_list< std::initializer_list< T >> matrix_data) |
Create matrix. Throws invalid argument if passed data doesn't match with amount of rows or columns. More... | |
constexpr std::size_t | get_m () const noexcept |
Get the amount of rows of the matrix. More... | |
constexpr std::size_t | get_n () const noexcept |
Get the amount of cols of the matrix. More... | |
constexpr std::array< T, n > & | operator[] (std::size_t pos) noexcept |
Get row of matrix at pos. No bounds checkin. More... | |
constexpr const std::array< T, n > & | operator[] (std::size_t pos) const noexcept |
Get row of matrix at pos. No bounds checkin. More... | |
constexpr std::array< T, n > & | at (std::size_t pos) |
Get row of matrix at pos. Throw out of range exception if out of range. More... | |
constexpr const std::array< T, n > & | at (std::size_t pos) const |
Get row of matrix at pos. Throw out of range exception if out of range. More... | |
constexpr bool | fuzzy_equal (const Matrix< T, m, n > &mat, T fuzz) const noexcept |
Fuzzy compare 2 matrices. More... | |
constexpr bool | operator== (const Matrix< T, m, n > &mat) noexcept |
Compare two matrices. More... | |
constexpr bool | operator!= (const Matrix< T, m, n > &mat) noexcept |
Compare two matrices. More... | |
constexpr void | operator+= (T scalar) noexcept |
Add a scalar from every element of the matrix. More... | |
constexpr void | operator-= (T scalar) noexcept |
Subtract a scalar from every element of the matrix. More... | |
constexpr void | operator*= (T scalar) noexcept |
Multiply every element of the matrix with a scalar. More... | |
constexpr void | operator/= (T scalar) noexcept |
Divide every element of the matrix with a scalar. More... | |
constexpr void | operator+= (const Matrix< T, m, n > &mat) noexcept |
Add a matrix to another matrix. More... | |
constexpr void | operator-= (const Matrix< T, m, n > &mat) noexcept |
Subtract a matrix to another matrix. More... | |
constexpr Matrix< T, m, n > | operator+ (const Matrix< T, m, n > &mat) const noexcept |
Add a matrix to another matrix. Returns a new matrix. More... | |
constexpr Matrix< T, m, n > | operator- (const Matrix< T, m, n > &mat) const noexcept |
Subtract a matrix from another matrix. Returns a new matrix. More... | |
template<std::size_t p> | |
constexpr Matrix< T, m, p > | operator* (const Matrix< T, n, p > &mat) const noexcept |
Multiply a matrix with the current matrix. More... | |
template<std::size_t p> | |
constexpr Matrix< T, m, n+p > | horizontal_augment (const Matrix< T, m, p > &mat) const noexcept |
Right augment the current matrix with the provided matrix. More... | |
template<std::size_t p> | |
constexpr Matrix< T, m+p, n > | vertical_augment (const Matrix< T, p, n > &mat) const noexcept |
Bottom augment the current matrix with the provided matrix. More... | |
template<std::size_t y, std::size_t x, std::size_t p, std::size_t q> | |
constexpr Matrix< T, p, q > | slice () const noexcept |
Create a new matrix from the current one where some columns and rows are sliced of. More... | |
constexpr Matrix< T, n, m > | transpose () const noexcept |
Transpose the matrix. More... | |
constexpr std::optional< Matrix< T, m, n > > | inverse () const noexcept |
Get the inverse of the matrix, implemented by using gauss-jordan. This operation is only available for square matrices/. More... | |
constexpr T | get_magnitude () const noexcept |
Get the magnitude of the matrix. This is equivalent to the euclidean distance. More... | |
std::string | str () const |
Get a string representation. More... | |
Static Public Member Functions | |
static constexpr Matrix< T, m, n > | get_identity () noexcept |
Get identity matrix. More... | |
Create a matrix with numerical values.
T | The numerical type to elements have. |
m | Amount of rows |
n | Amount of columns |
|
default |
Default copy constructor.
mat | The matrix to copy. |
|
default |
Default move constructor.
mat | The matrix to move. |
constexpr HLR::Kinematics::Matrix< T, m, n >::Matrix | ( | std::initializer_list< std::initializer_list< T >> | matrix_data | ) |
Create matrix. Throws invalid argument if passed data doesn't match with amount of rows or columns.
matrix_data | matrix_data The data to initialize matrix with. |
constexpr std::array<T, n>& HLR::Kinematics::Matrix< T, m, n >::at | ( | std::size_t | pos | ) |
Get row of matrix at pos. Throw out of range exception if out of range.
pos | The row to fetch. |
constexpr const std::array<T, n>& HLR::Kinematics::Matrix< T, m, n >::at | ( | std::size_t | pos | ) | const |
Get row of matrix at pos. Throw out of range exception if out of range.
pos | The row to fetch. |
|
noexcept |
Fuzzy compare 2 matrices.
mat | The matrix to compare with, |
fuzz | The maximum allowed difference between each value where they are still considered fuzzy equal. |
|
staticnoexcept |
Get identity matrix.
|
noexcept |
Get the amount of rows of the matrix.
|
noexcept |
Get the magnitude of the matrix. This is equivalent to the euclidean distance.
|
noexcept |
Get the amount of cols of the matrix.
|
noexcept |
Right augment the current matrix with the provided matrix.
p | The columns of the matrix to augment with. |
mat | The matrix that the current one will be augmented with. |
|
noexcept |
Get the inverse of the matrix, implemented by using gauss-jordan. This operation is only available for square matrices/.
|
noexcept |
Compare two matrices.
mat | The matrix to compare this one with. |
|
noexcept |
Multiply a matrix with the current matrix.
p | The columns of the matrix to multiply with. |
mat | The matrix to multiply with. |
|
noexcept |
Multiply every element of the matrix with a scalar.
scalar | scalar The scalar to multiply with. |
|
noexcept |
Add a matrix to another matrix. Returns a new matrix.
mat | The matrix to add to the current one. |
|
noexcept |
Add a scalar from every element of the matrix.
scalar | The scalar to add. |
|
noexcept |
Add a matrix to another matrix.
mat | The matrix to add to the current one. |
|
noexcept |
Subtract a matrix from another matrix. Returns a new matrix.
mat | The matrix to subtract from the current one. |
|
noexcept |
Subtract a scalar from every element of the matrix.
scalar | The scalar to subtract. |
|
noexcept |
Subtract a matrix to another matrix.
mat | the matrix to subtract from the current one. |
|
noexcept |
Divide every element of the matrix with a scalar.
scalar | The scalar to divide with. |
|
default |
Default assignment operator.
mat | The matrix that is assigned. |
|
default |
Default move assignment operator.
mat | The rvalue matrix that is assigned. |
|
noexcept |
Compare two matrices.
mat | The matrix to compare this one with. |
|
noexcept |
Get row of matrix at pos. No bounds checkin.
pos | pos The row to fetch. |
|
noexcept |
Get row of matrix at pos. No bounds checkin.
pos | The row to fetch. |
|
noexcept |
Create a new matrix from the current one where some columns and rows are sliced of.
y | The amount of rows to slice of from the top. |
x | The amount of columns to slice of from the bottom. |
p | The amount of rows to take. If larger then the original matrix the elements will be filled with 0. |
q | The amount of columns to take. If larger then the original matrix the elements will be filled with 0. |
std::string HLR::Kinematics::Matrix< T, m, n >::str | ( | ) | const |
Get a string representation.
|
noexcept |
Transpose the matrix.
|
noexcept |
Bottom augment the current matrix with the provided matrix.
p | The rows of the matrix to augment with. |
mat | The matrix that the current one will be augmented with. |