IOLink IOL_v1.8.0_release
|
An arithmetic square matrix. More...
#include <iolink/Matrix.h>
Public Member Functions | |
Matrix () | |
Default constructor. | |
Matrix (const ValueType *values) | |
Constructor with C-array parameter. | |
Matrix (const ValueType *values, bool isRowMajor) | |
Constructor with C-array parameter. | |
Matrix (std::initializer_list< ValueType > init) | |
Create a matrix giving initialization values. | |
bool | operator== (const Matrix &other) const |
bool | operator!= (const Matrix &other) const |
ValueType | at (size_t row, size_t column) const |
Access an element of the matrix. | |
ValueType | operator() (size_t row, size_t column) const |
Access an element of the matrix. | |
void | setAt (size_t row, size_t column, ValueType value) |
Set an element of the matrix. | |
void | transposeInPlace () |
Transpose the matrix in place. | |
Matrix | transpose () const |
Return the transposed matrix. | |
ValueType * | data () |
Exposes the internal data of the matrix, use it only if you know what you do. | |
const ValueType * | data () const |
Exposes the internal data of the matrix, use it only if you know what you do. | |
std::string | toString () const |
Return a string representation of the matrix. | |
Matrix | operator- () const |
Matrix & | operator+= (const Matrix &m) |
Matrix & | operator-= (const Matrix &m) |
Matrix | operator+ (const Matrix &m) const |
Matrix | operator- (const Matrix &m) const |
Matrix & | operator*= (ValueType value) |
Matrix & | operator/= (ValueType value) |
Matrix | operator* (ValueType v) const |
Matrix | operator/ (ValueType v) const |
Static Public Member Functions | |
static Matrix | identity () |
Return an identity matrix. | |
static Matrix | uniform (ValueType value) |
Initialize an uniform matrix with an unique value. | |
An arithmetic square matrix.
Do not use this class directly, only uses its aliases.
iolink::Matrix< ValueType, N >::Matrix | ( | ) |
Default constructor.
Object will have indeterminate values.
|
explicit |
Constructor with C-array parameter.
With the following matrix:
| a11 | a12 | a13 | a14 |
| a21 | a22 | a23 | a24 |
| a31 | a32 | a33 | a34 |
| a41 | a42 | a43 | a44 |
Values should be given to this function in ROW-major order: a11 a12 a13 a14 a21 a22 a23 a24 ...
values | Pointer on first element to use to initialize the NxN internal values |
iolink::Matrix< ValueType, N >::Matrix | ( | const ValueType * | values, |
bool | isRowMajor | ||
) |
Constructor with C-array parameter.
With the following matrix:
| a11 | a12 | a13 | a14 |
| a21 | a22 | a23 | a24 |
| a31 | a32 | a33 | a34 |
| a41 | a42 | a43 | a44 |
Values should be given to this function in:
values | Pointer on first element to use to initialize the NxN internal values |
isRowMajor | Boolean which indicates how given data must be stored |
|
explicit |
Create a matrix giving initialization values.
With the following matrix:
| a11 | a12 | a13 | a14 |
| a21 | a22 | a23 | a24 |
| a31 | a32 | a33 | a34 |
| a41 | a42 | a43 | a44 |
This fonction should be used this way:
Matrix4f m{a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44};
ValueType iolink::Matrix< ValueType, N >::at | ( | size_t | row, |
size_t | column | ||
) | const |
Access an element of the matrix.
column | The column of the element |
row | The row of the element |
ValueType * iolink::Matrix< ValueType, N >::data | ( | ) |
Exposes the internal data of the matrix, use it only if you know what you do.
As the internal layout of our matrices is column-major, the data will be in a different order than the initialisation list.
Example for the following matrix:
| a11 | a12 | a13 | a14 |
| a21 | a22 | a23 | a24 |
| a31 | a32 | a33 | a34 |
| a41 | a42 | a43 | a44 |
Data will return a buffer with the following data:
{a11, a21, a31, a41, a12, a22, a32 a42, a13, a23, a33, a43, a14, a24, a34, a44}
const ValueType * iolink::Matrix< ValueType, N >::data | ( | ) | const |
Exposes the internal data of the matrix, use it only if you know what you do.
As the internal layout of our matrices is column-major, the data will be in a different order than the initialisation list.
Example for the following matrix:
| a11 | a12 | a13 | a14 |
| a21 | a22 | a23 | a24 |
| a31 | a32 | a33 | a34 |
| a41 | a42 | a43 | a44 |
Data will return a buffer with the following data:
{a11, a21, a31, a41, a12, a22, a32 a42, a13, a23, a33, a43, a14, a24, a34, a44}
ValueType iolink::Matrix< ValueType, N >::operator() | ( | size_t | row, |
size_t | column | ||
) | const |
Access an element of the matrix.
column | The column of the element |
row | The row of the element |
void iolink::Matrix< ValueType, N >::setAt | ( | size_t | row, |
size_t | column, | ||
ValueType | value | ||
) |
Set an element of the matrix.
column | The column of the element |
row | The row of the element |
value | The value to assign to the element |
|
static |
Initialize an uniform matrix with an unique value.
value | The value to assign to each element of the matrix |