Registered Member
|
Hello,
Is their a better way to fill a sparse matrix that is known to be symmetric. Right now I'm using something like this:
Thanks for your amazing work on Eigen! |
Registered Member
|
This is what I do:
[code] // Eigen::SparseMatrix<float,1> M; //fill it out M.startFill(); for (i=0;i<N;i++) { // loop some j M.fill(i,j) = value; } M = M + Eigen::SparseMatrix<float,1>(M.transpose()); [\code] I am not sure which one is faster. Is there another way to do this? |
Moderator
|
ideally, if you know your matrix is symmetric, you should only fill one half (the upper or lower triangular part), and then use the selfadjointView API to view and use it as a symmetric/selfadjoint matrix.
Unfortunately I'm pretty sure that for the sparse module, the seladjointView API is very incomplete. But the goal is to have this working: // fill the upper part of a c = a.selfadjointView<Upper>() * b; maybe the above already works with b a dense vector/matrix, I don't remember... |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]