This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Selfadjoint matrices and noalias

Tags: None
(comma "," separated)
Plato
Registered Member
Posts
3
Karma
0

Selfadjoint matrices and noalias

Mon Nov 14, 2011 11:25 pm
Hi,

I would like to perform operations of the form

A = B*B.transpose();

Since A is symmetric, I tried using something like

A.triangularView<Eigen::Lower>().noalias() = B*B_transpose();

But this fails at compilation, since views cannot be used with noalias, as it seems. What would be the correct way of writing the above expression to be able to use both the fact that no aliasing happens, and that the result is symmetric?

In a related question, I also need to write expressions of the form

C = C - D*D.transpose();

If I write it as

C.selfadjointView<Eigen::Lower>().rankUpdate(D,-1.0);

does rankUpdate assume that no aliasing happens?

Thank you!

Plato
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Yes rankUpdate assumes no aliasing by default. So you can also implement the first case as:

A.setZero();
A.selfadjointView<Eigen::Lower>().rankUpdate(B);


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]