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

Eigen 3.3 sparseMat.col(i).innerIndexPtr()

Tags: None
(comma "," separated)
joaoruileal
Registered Member
Posts
18
Karma
0
OS
Hello,

There appears to have been a change in eigen that makes the following code behave differently in 3.3
Code: Select all
Eigen::SparseMatrix<double> m(3, 3);
m.setIdentity();
assert(m.col(1).innerIndexPtr()[0] == 1);

I would expect the innerIndexPtr() of the second column to start with "1" but it returns "0".
col(i).innerIndexPtr() always returns the m.innerIndexPtr().
Could this be a bug?

Best regards,
João
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
This is intentional. You're not supposed to use innerIndexPtr without using outerIndexPtr first to find where to look in innerIndexPtr. So the correct code is:

assert(m.col(1).innerIndexPtr()[ m.col(1).outerIndexPtr()[0] ] == 1);
joaoruileal
Registered Member
Posts
18
Karma
0
OS
I see!
Thank you!


Bookmarks



Who is online

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