12#include <argos3/core/utility/math/general.h>
13#include <argos3/core/utility/math/angles.h>
19 template <UInt32 ROWS, UInt32 COLS>
23 template <UInt32 SMROWS, UInt32 SMCOLS>
friend class CMatrix;
45 if(
this != &c_matrix) {
54 "Matrix index out of bounds: un_row = " <<
64 "Matrix index out of bounds: un_row = " <<
73 "Matrix index out of bounds: un_idx = " <<
80 "Matrix index out of bounds: un_idx = " <<
86 for(
UInt32 i = 0; i < ROWS * COLS; i++)
91 for(
UInt32 i = 0; i < ROWS * COLS; i++)
96 Real fNewValues[COLS * ROWS];
97 for(
UInt32 i = 0; i < ROWS; i++)
98 for(
UInt32 j = 0; j < COLS; j++)
99 fNewValues[j * ROWS + i] =
m_pfValues[i * COLS + j];
104 template <UInt32 SMROWS, UInt32 SMCOLS>
107 UInt32 un_offset_col)
const {
109 (SMCOLS - 1 + un_offset_col) < COLS,
110 "Submatrix range is out of bounds: cannot extract a " <<
111 SMROWS <<
"x" << SMCOLS <<
" submatrix from a " <<
112 ROWS <<
"x" << COLS <<
" matrix with offsets " <<
113 " un_offset_row = " <<
115 ", un_offset_col = " <<
118 for(
UInt32 i = 0; i < SMROWS; i++)
119 for(
UInt32 j = 0; j < SMCOLS; j++)
120 c_sub_matrix.
m_pfValues[i * SMCOLS + j] =
m_pfValues[(i + un_offset_row) * COLS + (j + un_offset_col)];
124 for(
UInt32 i = 0; i < ROWS * COLS; i++) {
132 for(
UInt32 i = 0; i < ROWS * COLS; i++) {
139 for(
UInt32 i = 0; i < ROWS * COLS; i++) {
146 for(
UInt32 i = 0; i < ROWS * COLS; i++) {
171 Real fNewValues[ROWS * COLS];
172 for(
UInt32 i = 0; i < ROWS; i++) {
173 for(
UInt32 j = 0; j < COLS; j++) {
174 fNewValues[i * COLS + j] = 0.0f;
175 for(
UInt32 k = 0; k < COLS; k++) {
184 template <UInt32 OTRCOLS>
186 Real fNewValues[ROWS * OTRCOLS];
187 for(
UInt32 i = 0; i < ROWS; i++) {
188 for(
UInt32 j = 0; j < OTRCOLS; j++) {
189 fNewValues[i * OTRCOLS + j] = 0.0f;
190 for(
UInt32 k = 0; k < COLS; k++) {
201 std::ios_base::fmtflags unInitalFlags = c_os.flags();
202 std::streamsize nInitalPrec = c_os.precision();
204 c_os.setf(std::ios::fixed);
207 for(
UInt32 i = 0; i < ROWS; i++) {
209 for(
UInt32 j = 0; j < COLS; j++) {
210 c_os << std::setw(6) << c_matrix(i, j) <<
" ";
212 c_os <<
"|" << std::endl;
215 c_os.flags(unInitalFlags);
216 c_os.precision(nInitalPrec);
unsigned int UInt32
32-bit unsigned integer.
float Real
Collects all ARGoS code.
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
The namespace containing all the ARGoS related code.
friend class CRotationMatrix2
CMatrix< ROWS, COLS > & operator+=(const CMatrix< ROWS, COLS > &c_matrix)
bool operator==(const CMatrix< ROWS, COLS > &c_matrix) const
Real operator()(UInt32 un_idx) const
CMatrix< ROWS, COLS > & operator*=(Real f_scale)
friend std::ostream & operator<<(std::ostream &c_os, const CMatrix &c_matrix)
CMatrix< ROWS, COLS > operator-() const
CMatrix< ROWS, COLS > & operator-=(const CMatrix< ROWS, COLS > &c_matrix)
CMatrix< ROWS, OTRCOLS > operator*(const CMatrix< COLS, OTRCOLS > &c_matrix) const
CMatrix< ROWS, COLS > & operator*=(const CMatrix< COLS, COLS > &c_matrix)
CMatrix< COLS, ROWS > GetTransposed() const
CMatrix< ROWS, COLS > operator+(const CMatrix< ROWS, COLS > &c_matrix) const
friend class CRotationMatrix3
Real operator()(UInt32 un_row, UInt32 un_col) const
Real & operator()(UInt32 un_row, UInt32 un_col)
Real & operator()(UInt32 un_idx)
void Set(const Real *f_values)
friend class CTransformationMatrix3
CMatrix(const CMatrix< ROWS, COLS > &c_matrix)
void GetSubMatrix(CMatrix< SMROWS, SMCOLS > &c_sub_matrix, UInt32 un_offset_row, UInt32 un_offset_col) const
CMatrix(const Real *pf_values)
Real m_pfValues[ROWS *COLS]
CMatrix< ROWS, COLS > & operator=(const CMatrix< ROWS, COLS > &c_matrix)
friend class CTransformationMatrix2
CMatrix< ROWS, COLS > operator-(const CMatrix< ROWS, COLS > &c_matrix) const