[eigen] Implementing a custom-matrix product
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: [eigen] Implementing a custom-matrix product
• From: Manoj Rajagopalan <rmanoj@xxxxxxxxx>
• Date: Tue, 13 Jul 2010 18:26:52 -0400
• Organization: EECS Dept., University of Michigan, Ann Arbor, MI, USA

```Hi,

I have a basic implementation of a SymmetricMatrix class that stores only
the lower triangle in Rectangular Full Packed Format (RFPF) from a LAWN
reference that Gael mentioned a little while ago.

I would like to implement a SymmetricMatrix * Matrix product. How do I go
about it? Here are my preliminary issues:

- classes like DiagonalWrapper and TriangularView return a custom class like
DiagonalProduct and TriangularProduct when the pre-multiplication operator *
(member function) is called. But then, someone mentioned ReturnByValue in a
different context but that also seems to serve a similar purpose. I am a
little confused. How do these concepts relate? Are they mutually exclusive?

- I am not able to identify which member of the dense matrix class hierarchy
actually performs the evaluation of the product into a matrix with
dense-storage. Even DenseStorageBase seems to be passing this off to its base
class operator=() or some _set() method.

- There are coeff() methods that return Scalar, and there are packet() methods
that return PacketScalar. I am guessing the latter is used when the
expression is vectorizable. How and where is this decided?

- The product that I am interested in shouldn't have to worry about
PacketScalar etc. because it reduces to a sequence of high-level Eigen TRMM
and GEMM calls. This is due to the layout - the triangular part is stored as
two sub-triangles (one is adjoint-ed) and one rectangular block, all packed
so that they form a rectangular array of total size N*(N+1)/2. When the
product evaluation is triggered, the most efficient operation would be with
these triangular/rectangular blocks as opposed to coeff() or packet() access
which would be expensive. How can this be ensured?

Thanks,
Manoj

```

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