Re: [eigen] Adding general (dense matrix) expressions and diagonal matrix expressions

[ Thread Index | Date Index | More Archives ]


I guess you are referring to coefficient-wise expressions like A+diag(v). The difficulty is that for performance reasons, it is crucial to separate the dense part from the diagonal part so that we can evaluate the dense part at once and then add/subtract the diagonal part. For instance, if you have:

C = A + diag(v) - 2*B - 3*diag(w)

we would have to rewrite the _expression_ as:

C = (A- 2*B) + diag(v-3*w)  

to then be able to optimally evaluate it in two steps as:

C = A- 2*B
diag(C) += v-3*w

This is not possible in Eigen 3.2, and in Eigen 3.3, doing the last step is straightforward. Rewriting the _expression_ is also doable (to some extent), but at the cost of significant compilation times.

Could you provide a typical example of the expressions you want to assemble?


On Tue, Mar 22, 2016 at 12:19 PM, Dan Čermák <dan.cermak@xxxxxxxxxxxxxxxxxxx> wrote:
Hi everyone,

I am frequently running into the problem, that I can't add general dense
matrix expressions and diagonal matrix expressions.

Is there any way around this problem? I would really like to be able to create
expressions of that kind since then I could simply let some of my functions
return them and add them up without having to keep track of the diagonal and
non-diagonal expressions myself.

Is something planed to be implemented in the long run or is this fundamentally

Thanks in advance,


Mail converted by MHonArc 2.6.19+