Helper base class that provides an access interface to the Matrix template class and its scalar specialization.
More...
#include <matrix.h>
|
double | _m [Rows *Cols] |
| array with matrix elements
|
|
template<uint Rows, uint Cols>
class CTL::mat::MatrixBase< Rows, Cols >
Helper base class that provides an access interface to the Matrix template class and its scalar specialization.
◆ MatrixBase() [1/3]
template<uint Rows, uint Cols>
Construct an instance and initialize all elements with a fillValue.
◆ MatrixBase() [2/3]
template<uint Rows, uint Cols>
Construct an instance from a C-style array. The array length must match the total number of matrix elements, otherwise it results in a compilation error.
◆ MatrixBase() [3/3]
template<uint Rows, uint Cols>
template<typename... Doubles>
Directly initialize the underlying C-style array double[]
using the passed elements.
◆ at() [1/4]
template<uint Rows, uint Cols>
Returns a reference to the element with index (row, column). A run time boundary check is performed and an exception is thrown if an index exceeds the matrix dimensions (throws out_of_range).
◆ at() [2/4]
template<uint Rows, uint Cols>
Returns the element with index (row, column). A run time boundary check is performed and an exception is thrown if an index exceeds the matrix dimensions (throws out_of_range).
◆ at() [3/4]
template<uint Rows, uint Cols>
Returns a reference to the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A run time boundary check is performed and an exception is thrown if an index exceeds the matrix dimensions (throws out_of_range).
- See also
- at(uint row, uint column)
◆ at() [4/4]
template<uint Rows, uint Cols>
Returns the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A run time boundary check is performed and an exception is thrown if an index exceeds the matrix dimensions (throws out_of_range).
- See also
- at(uint row, uint column) const
◆ begin() [1/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. The elements are internally stored in a linear array in row major order. Same as data().
◆ begin() [2/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. This const
version prohibits manipulations of the matrix elements through dereferencing the pointer. The elements are internally stored in a linear array in row major order. Same as data().
◆ constBegin()
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. This const
version prohibits manipulations of the matrix elements through dereferencing the pointer, even when this methods is called from a non-const instance. The elements are internally stored in a linear array in row major order. Same as constData().
◆ constData()
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. This const
version prohibits manipulations of the matrix elements through dereferencing the pointer, even when this methods is called from a non-const instance. The elements are internally stored in a linear array in row major order. Same as constBegin().
◆ constEnd()
template<uint Rows, uint Cols>
Returns a pointer to the element following the last element of the matrix. This const
version prohibits manipulations of the matrix elements through dereferencing the pointer, even when this methods is called from a non-const instance. This pointer is useful for having a boundary when looping over the matrix elements. However, attempting to access it results in undefined behavior.
◆ data() [1/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. The elements are internally stored in a linear array in row major order. Same as begin().
◆ data() [2/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element of the matrix. This const
version prohibits manipulations of the matrix elements through dereferencing the pointer. The elements are internally stored in a linear array in row major order. Same as begin().
◆ end() [1/2]
template<uint Rows, uint Cols>
Returns a pointer to the element following the last element of the matrix. This pointer is useful for having a boundary when looping over the matrix elements. However, attempting to access it results in undefined behavior.
◆ end() [2/2]
template<uint Rows, uint Cols>
Returns a pointer to the element following the last element of the matrix. This pointer is useful for having a boundary when looping over the matrix elements. However, attempting to access it results in undefined behavior.
◆ get() [1/4]
template<uint Rows, uint Cols>
template<uint row, uint column>
Returns a reference to the element with index (row, column). A compile time boundary check is performed. This function never fails.
◆ get() [2/4]
template<uint Rows, uint Cols>
template<uint row, uint column>
Returns the element with index (row, column). A compile time boundary check is performed. This function never fails.
◆ get() [3/4]
template<uint Rows, uint Cols>
template<uint n>
Returns a reference to the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A compile time boundary check is performed. This function never fails.
◆ get() [4/4]
template<uint Rows, uint Cols>
template<uint n>
Returns the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A compile time boundary check is performed. This function never fails.
◆ info()
template<uint Rows, uint Cols>
Prints the content of the matrix into the returned string. The lineModifier may be used to annotate or emphasis the output by prefixing each line by a character sequence.
Matrix<2, 4> M{ 1.1, -1.2, -1.3, 1.4,
-2.1, 2.2, -2.3, 2.4 };
std::cout << M.info("important 2 rows: ");
The conversion from double
to string is performed using std::to_string
. You may switch between language specific decimal "." or "," using the function
std::setlocale(LC_NUMERIC, "en_US.UTF-8");
or
std::setlocale(LC_NUMERIC, "de_DE.UTF-8");
◆ norm()
template<uint Rows, uint Cols>
Returns the Euclidian norm of a row or column vector, i.e. from a Matrix<1, N>
or Matrix<N, 1>
.
If the macro ENABLE_FROBENIUS_NORM
is defined (before matrix.h
), it can be also used for arbitrary matrices. In this case it computes the Frobenius norm of the matrix (sqrt of the sum of squared elements).
◆ operator!=()
template<uint Rows, uint Cols>
Returns true
if there is at least one element that is not equal for both matrices, which means the matrices does not have the equal (byte) representation.
◆ operator()() [1/4]
template<uint Rows, uint Cols>
Returns a reference to the element with index (row, column). A run time boundary check is not performed.
◆ operator()() [2/4]
template<uint Rows, uint Cols>
Returns the element with index (row, column). A run time boundary check is not performed.
◆ operator()() [3/4]
template<uint Rows, uint Cols>
Returns a reference to the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A run time boundary check is not performed.
◆ operator()() [4/4]
template<uint Rows, uint Cols>
Returns a reference to the element from a 1D index lookup n, where the matrix elements are stored in row major order. This function is handy in particular when dealing with vectors. A run time boundary check is not performed.
◆ operator==()
template<uint Rows, uint Cols>
Returns true
if all elements are equal, which means they have the equal (byte) representation of all elements; otherwise false.
◆ operator[]() [1/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element in a row. A run time boundary check is not performed. Elements are stored in row major order.
◆ operator[]() [2/2]
template<uint Rows, uint Cols>
Returns a pointer to the first element in a row. A run time boundary check is not performed. Elements are stored in row major order.
◆ size()
template<uint Rows, uint Cols>
Returns the total number of elements that is Rows*Cols
.
The documentation for this class was generated from the following files:
- modules/src/mat/matrix.h
- modules/src/mat/matrix.tpp