kdeblabla
Registered Member

I want to compute a symmetric matrix A from a vector b by: A = b * b'.
Does the Eigen library automatically take into account that it does not need to do all calculations to get A (because of the symmetry which repeats most of the matrix entries)? 
jitseniesen
Registered Member

No, not automatically. You need to specify this yourself. The .rankUpdate() member function performs the computation A = A + b * b' on the upper or lower triangular part of A (here, b' is the transpose of b, which is I assume the notation you use). So you can do:

kdeblabla
Registered Member

Thanks, that's exactly what I was looking for. Do you have any indication of the speed differences between this method and the ordinary A = b * b' ? 
ggael
Moderator

You can expect a x2 for large matrices (>1000^2) and no speed up for small ones (around 30^2). Also, the rankUpdate version is not multithreaded, so even for large matrices it can be slower if you enabled OpenMP.

Registered users: arucard, Bing [Bot], broadstairs, elvisangelaccio, Exabot [Bot], glepore70, gnowak, Google [Bot], google01103, Ham Radio, lsnd, manuelmuzzurru, pepedopolous, ripper17, Spinell, Yahoo [Bot]