# Prerequisites

## Introduction to Cxx\_matrix

The tutorial is based on the C++ project [Cxx\_matrix](https://github.com/TrustInSoft-CI/Cxx_matrix).&#x20;

Its source code on GitHub contains 2 source files:

* `matrix.h` that is a matrix operations library coded in C++
* `matrix.cpp` that is a simple test over this library

Let's familiarize ourselves with the `main` function in `matrix.cpp`:

```cpp
int
main(void) {
    Matrix<2U, 2U> matrix_a {
        2., 1.,
        4., 2. };

    auto id = identity<2>();
    bool has_inverse = is_invertible(id);
    std::cout << "identity is inversible: " << (has_inverse ? "yes\n" : "no\n");

    Matrix<2U, 2U> matrix_b = matrix_a + (5 ^ id);
    Matrix<2, 1> res = solve(matrix_b,  { 6., 10. });
    std::cout << "RESULT IS:\n" << res;

    return 0;
    (void) has_inverse;
}
```

The test implemented in `main` performs the following step:

* It initializes a 2 x 2 matrix
* It verifies if the matrix is invertible
* It performs some basic operations on this matrix
* It solves a matrix equation

## Launching the analyzer

We already configured the project [Cxx\_matrix](https://github.com/TrustInSoft-CI/Cxx_matrix) for TrustInSoft CI by adding a [`.trustinsoft/config.json`](https://github.com/TrustInSoft-CI/Cxx_matrix/blob/master/.trustinsoft/config.json) file to the repository. In our example, the [Analyses configuration](https://docs.ci.trust-in-soft.com/configuration-file/analyses-configuration-file) specifies the source file `matrix.cpp` to analyze, the analysis entry point function `main` and the preprocessor option `-I.`.

We also launched the analysis in TrustInSoft CI:

**1.** Load the following URL in your browser to visualize a summary of the analysis results: \
<https://ci.trust-in-soft.com/projects/TrustInSoft-CI/Cxx_matrix/latest>

There is only one analysis, as one entry point, and no undefined behavior on the tested path:

![](https://3982345336-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpYF4Rmm1tt0M5Cn4E0%2F-MeeloZE64y5K-3yRxAU%2F-MeemQrFwLgzsOARfbdJ%2Fimage.png?alt=media\&token=dc4f6670-1ba7-4633-b948-89c69f889ec6)

**2.** Launch TrustInSoft CI Analyzer by clicking the `#1` analysis and then on the `Inspect with TrustInSoft CI Analyzer` button.

![](https://3982345336-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpYF4Rmm1tt0M5Cn4E0%2F-MeeloZE64y5K-3yRxAU%2F-Meemd99ogqZiso74Olq%2Fimage.png?alt=media\&token=b0f5fe6e-1778-4d58-8ee8-e39ab6841e77)

Next let's dive into C++ identifiers, constructions and calling conventions in TrustInSoft CI Analyzer.
