[eigen] Recursive Matrices in Eigen
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: [eigen] Recursive Matrices in Eigen
• From: Darius Rueckert <darius.rueckert@xxxxxx>
• Date: Wed, 29 May 2019 10:21:51 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fau.de; s=fau-2013; t=1559118114; bh=pvuumCCHwn35+aguU6wg/Q6K6BOanXa3g+37gaEFMbo=; h=To:From:Subject:Date:From:To:CC:Subject; b=CYk2LT/qGElprcRo7XXPCvBhmPOFzG0z2DdNFF/vJK4C9esQBuX3ypIydvDNbITPH biVDGMSlr+0RlAW1h4ELPhcXKTRkExiesaMH7kCvPq3Xx9WhpdfQMSrEB2gmuARvtt XFX/7HNi9XaMMlLC4+mXcj0PjD24lMnr6XX/ycO87TEfkxQ9tnY8Ut33n4EHpsgS32 EIai2HVgGwNWOa2ZEw5B3jsCWw7z0uXcLiiYIdkQYXcWVwQPXx02udyaWCBy7g3JnY VFV6Eu/MLQfimyoBsD0LXcgMreOaaIHwi78o9iUkqSVPM8bG0u276zzo2jkPW1e/f7 rBS3P3S6hi3Gg==

```Hello everyone,

```
for the past months we have been working on making recursive matrices work in eigen. Here is an example:
```
SparseMatrix<Matrix<double,4,3>> A;
Matrix<Matrix<double,4,1>,-1,1> x,b;
x = A * b;

```
The obvious advantage is that we get support for block matrices on all eigen types for "free" ( DiagonalMatrix,TriangularView,LDLT,...). After some testing, the performance appeared to be "better than expected" and we have decided to write a paper on how to apply recursive matrices on non-linear least squares problems. The paper is accepted and will be published at HPG in July. Here is the current version:
```
https://cloud9.cs.fau.de/index.php/s/UINyrgAUtaAiWvR

Unfortunately there are two limitations which I was not able to fix.

```
1. All inner matrix types require an additional wrapper class, which I have called "MatrixScalar". The matrix A from above is then:
```
SparseMatrix<MatrixScalar<Matrix<double,4,3>>> A;

```
2. Some eigen kernels do not work directly. For example, some operations use the function scaleAndAddTo(..., Scalar(1)), which does not work if "Scalar" is a recursive matrix type. To fix this I had to specialize a lot of eigen kernels, which creates redundancy with only minor changes.
```

So here are my questions to you:

```
Do you think a deep integration into eigen would be possible? (Without recursive specializations and without "MatrixScalar" class)
```
The code can be found here:
https://github.com/darglein/EigenRecursive

Example for sparse block-matrices:
https://github.com/darglein/EigenRecursive/blob/master/samples/sparseOperators/sparseOperators_main.cpp

With best regards,
Darius

--
Darius Rueckert
Informatik 9 (Graphische Datenverarbeitung) http://lgdv.tf.fau.de
Universitaet Erlangen-Nuernberg, Cauerstraße 11, 91058 Erlangen

```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/