Matrices up to 3x3 are inverted directly at generation time. For larger matrices, a strategy can be selected via the Knowledge parameter`experimental_resolveInverseFunctionCall`:
**Cofactors*: Invert at generation-time using cofactors matrix
**GaussJordan*: Invert at generation-time using the Gauss-Jordan algorithm
**Runtime* Invert only at run-time of the program time
#### Access
Vectors and Matrices can be written to and read from via the `[]-operator`:
Small linear systems can be solved directly at runtime or compiletime with the `solveMatSys`-statement, which takes a system matrix, unknowns and a right-hand-side of fitting dimensions as arguments:
<pre>
Var A : Matrix<Real, 3, 3> = {{3,2,-1},{2,-2,4},{-1,0.5,-1}}
Var f : Matrix<Real, 3, 1> = {{1},{-2},{0}}
Var u : Matrix<Real, 3, 1>
solveMatSys A,u,f // u = {{1}, {-2}, {-2}}
</pre>
Additional information about the `shape` of a matrix can be added:
<pre>
solveMatSys A2,u2,f2 {shape=blockdiagonal,block=3} // A2 is a blockdiagonal matrix with blocks of size 3x3
</pre>
The generator will then produce a routine that exploits the shape of the matrix.<br/>
Supported shapes are:
*`blockdiagonal` with `block`=... (diagonal block size)
*`diagonal`
If `experimental_resolveLocalMatSys` is set to `Runtime`, the system will be solved at runtime of the generated application.
If `experimental_resolveLocalMatSys` is set to `Compiletime`, the system will be solved at generation time with certain restrictions.
#### Inversion
Matrices can be inverted by the `inverse()` function.
Additional information about the shape of a matrix can be added as arguments.
Next to `blockdiagonal` and `diagonal` matrices, also a `Schur-shape` (https://en.wikipedia.org/wiki/Schur_complement) can be specified,
which allows a specialized solution technique.
If `experimental_resolveInverseFunctionCall` is set to `Runtime`, the inversion will be executed at runtime of the generated application.
If `experimental_resolveInverseFunctionCall` is set to `Compiletime`, the inversion will be executed at generation time with certain restrictions.
### Solve locally extensions
#### System matrix shapes
The shape of the systems set up by [ solve locally ](#local-solve) statements can also be used to speed up the solution:
* If it is known, it can be communicated to the generator with the knowledge-attribute `experimental_locMatShape`.
(in case of a Schur or blockdiagonal shape, also the attributes `experimental_locMatBlocksize`, `experimental_locMatShapeA` and `experimental_locMatBlocksizeA` can be specified)
* Another possible way is to provide the shape with the field declaration of the iterated field. Here, the same syntax as in section 'direct solution of linear systems' is used.
#### Execution time
*`experimental_resolveLocalMatSys` also determines execution time of solution of solve-locally-systems.
* if `experimental_evalMOpRuntimeExe` is set, [ solve locally ](#local-solve)-systems will be solved depending on their size:
small systems are feasible for solution at compiletime in order to reduce the runtime of the generated application.
Larger systems can only be solved at runtime as they increase the compiletime extremely if executed at compiletime.
#### Shape classification
An automatic classification of the present shape with all block sizes in a solve-locally-system is done if the knowledge-attribute `experimental_classifyLocMat` is set to 'true'.
Currently, the three mentioned shapes diagonal, blockdiagonal and Schur are supported for automatic classification.