## Task #2835

Task #2834: C++ matrix classes

### Matrix class constraint to upper or lower triangle

**Description**

To express assumptions about matrices during compile time, a type shall reflect the matrix properties.

This matrix class needs to fullfil the following properties

- enable upper/lower diagonal representation
- efficient algebraic operations
- implicit conversion to full matrix

### History

#### #1 Updated by Roland Schulz over 1 year ago

I suggest to implement this as a new layout type. After that it is possible to create a specific mdspan like template alias. If we also give MultiDimArray a layout template argument (which defaults to left) we can do the same thing for it.

#### #2 Updated by Berk Hess over 1 year ago

It would be good if the actual memory layout is the same as the Matrix3x3, so we can directly pass a triangle matrix to functions taking const Matrix3x3.

#### #3 Updated by Berk Hess over 1 year ago

The physical memory layout of box corresponds to the transpose of the matrix M that give M*t = c where t is a triclinic coordinate system vector and c Cartesian. That seems to be the only reason for preferring the transposed layout.

In practice we would like to modify as little code as possible and especially not introduce bugs in other code outside the main repository, so keeping access the same is the main priority. Thus [][] on Matrix3x3 should give the same result as on [][[].

Performance wise nothing of this matters, as box vectors are always copied or transformed before applying them to a list of atoms.

#### #4 Updated by Gerrit Code Review Bot over 1 year ago

Gerrit received a related patchset '1' for Issue #2835.

Uploader: Christian Blau (cblau@gwdg.de)

Change-Id: gromacs~master~Ia8369d2d2a61fd2a79017d16759e0bd1499c2fa1

Gerrit URL: https://gerrit.gromacs.org/9106