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

allocating symmetric matrices

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

allocating symmetric matrices

Sat Nov 27, 2010 1:20 pm
Hello,

I want to allocate a symmetric double matrix hoping that only half the entries are stored.
How do I do that?

Say I have a symmetric 5x5 matrix A and I do A(1,2)=3.0;
What then happens?
Does it remain symmetric (i.e A(2,1)=3.0; automatically)
or does it cease to be symmetric and then allocates a full rectangular array?

As an aside, if you really store only half the entries in a symmetric matrix
you will have to probably do something like

return (i<j)? data[i][j]:data[j][i];

in the definition of the entry accessor operator.
Does this slow down the accessor significantly, or is there a better solution?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: allocating symmetric matrices

Mon Nov 29, 2010 8:39 am
Hi,

so far there is no compact symmetric storage. You have to use a square dense matrix, and then use the selfadjointView<>() method to operate on one half of the matrix. Compact storage will come later on. Probably for 3.1. See this entry:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=42
to follow the discussions and progress.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient