User Tools

Site Tools


This is an old revision of the document!

Vectors and Matrices

The blocks in the control system are connected among each other with the aid of signals. As described in Signals they carry a timestamp and a value. The value could be a simple type such as an integer or float. Quite often it will consist of a vector or a matrix. A three dimensional vector of type double can be declared and initialized as follows:

  Vector<3, double> v; 
  v << 1.5, -2, 0;

The declaration could be simplified to

  Vector3<> v; 
  v << 1.5, -2, 0;

as Vector3 is a predefined type with three dimensions and the default element type is double. A matrix of 3 times 3 with element type int could be defined as

  Matrix<3, 3, int> m; 
  m << 1, 4, 7,
       2, 5, 8,
       3, 6, 9;

Accessing Elements

tools/matrix/start.1489749345.txt.gz · Last modified: 2017/03/17 12:15 (external edit)