User Tools

Site Tools


tools:matrix:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tools:matrix:start [2021/09/17 08:52] – [Vectors and Matrices] ursgraftools:matrix:start [2021/11/14 16:41] ursgraf
Line 3: Line 3:
 <code cpp> <code cpp>
 Vector<3, double> v;  Vector<3, double> v; 
-v << 1.5, -2, 0; 
 </code> </code>
 The declaration could be simplified to  The declaration could be simplified to 
 <code cpp> <code cpp>
 Vector3<> v;  Vector3<> v; 
-v << 1.5, -2, 0; 
 </code> </code>
-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+as ''Vector3'' is a predefined type with three dimensions and the default element type is ''double''A ''Vector3'' is identical to the type ''Matrix<3,1,double>''. The vector could be initializer as follows 
 +<code cpp> 
 +v = {1.5, -2, 0} 
 +v << 1.5, -2, 0; // or with input operator 
 +Vector3 v{1,2,3}; // or directly upon declaration 
 +</code> 
 +A matrix of 3 times 3 with element type ''int'' could be defined as
 <code cpp> <code cpp>
 Matrix<3, 3, int> m;  Matrix<3, 3, int> m; 
Line 48: Line 52:
 log.info() << m; log.info() << m;
 </code> </code>
- 
 With the 3 x 3 matrix from above we would get With the 3 x 3 matrix from above we would get
- +<code> 
-<code bash+2021-09-16 17:36:53:929    I:  [ [1 4 7]' [2 5 8]' [3 6 9]' ]
-2021-09-16 17:36:53:929    E:  [ [1 4 7]' [2 5 8]' [3 6 9]' ]+
 </code> </code>
-The matrix is plotted colon per colon.+The matrix is plotted colon per colon. To give some more examples: 
 +<code cpp> 
 +Matrix<1,1> m1{1}; 
 +Matrix<2,1> m2{1,2}; 
 +Matrix<1,2> m3{1,2}; 
 +</code> 
 +This matrices will be printed as  
 +<code> 
 +2021-09-16 17:37:18:122    I:  [1]' 
 +2021-09-16 17:37:18:122    I:  [1 2]' 
 +2021-09-16 17:37:18:122    I:  [ [1]' [2]' ]' 
 +</code> 
 + 
 +===== Matrix Operations ===== 
tools/matrix/start.txt · Last modified: 2022/04/20 13:29 by ursgraf