ARGoS  3
A parallel, multi-engine simulator for swarm robotics
squarematrix.h
Go to the documentation of this file.
1 
9 #ifndef SQUARE_MATRIX_H
10 #define SQUARE_MATRIX_H
11 
12 #include "matrix.h"
13 
14 namespace argos {
15 
16  template <UInt32 DIM>
17  class CSquareMatrix : public CMatrix<DIM, DIM> {
18 
19  public:
20  CSquareMatrix() : CMatrix<DIM, DIM>() {}
21 
23  for(UInt32 i = 0; i < DIM; i++) {
24  for(UInt32 j = 0; j < DIM; j++) {
25  if(i == j) {
26  CMatrix<DIM, DIM>::m_pfValues[i * DIM + j] = 1;
27  }
28  else {
29  CMatrix<DIM, DIM>::m_pfValues[i * DIM + j] = 0;
30  }
31  }
32  }
33  }
34 
36  bool bIsIdentMat = true;
37  for(UInt32 i = 0; i < DIM; i++) {
38  for(UInt32 j = 0; j < DIM; j++) {
39  if(i == j) {
40  if(CMatrix<DIM, DIM>::m_pfValues[i * DIM + j] != 1) {
41  bIsIdentMat = false;
42  break;
43  }
44  }
45  else {
46  if(CMatrix<DIM, DIM>::m_pfValues[i * DIM + j] != 0) {
47  bIsIdentMat = false;
48  break;
49  }
50  }
51  }
52  }
53  return bIsIdentMat;
54  }
55  };
56 }
57 
58 #endif
argos
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
argos::CSquareMatrix
Definition: squarematrix.h:17
argos::CSquareMatrix::CSquareMatrix
CSquareMatrix()
Definition: squarematrix.h:20
argos::CSquareMatrix::IsIdentityMatrix
bool IsIdentityMatrix()
Definition: squarematrix.h:35
argos::CMatrix
Definition: matrix.h:20
UInt32
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
argos::CSquareMatrix::SetIdentityMatrix
void SetIdentityMatrix()
Definition: squarematrix.h:22
matrix.h