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

Insert a SparseVector into a SparseMatrix as Row

Tags: None
(comma "," separated)
niklasl
Registered Member
Posts
5
Karma
0
I am new to Eigen and am trying to fill a SparseMatrix row by row, by inserting the rows as SparseVectors. Here's the way I planned to do it:

Code: Select all
Eigen::SparseMatrix<double> A(100, 100);

A.row(1) = Eigen::SparseVector<double>(100);


But unfortunately I get errors:

Code: Select all
eigen\src/SparseCore/SparseMatrixBase.h(218): error C2039: 'insertBackByOuterInner' : is not a member of 'Eigen::Block<XprType,BlockRows,BlockCols,InnerPanel>
eigen\src/SparseCore/SparseMatrixBase.h(214): error C2039: 'startVec' : is not a member of 'Eigen::Block<XprType,BlockRows,BlockCols,InnerPanel>'


and a couple more, all saying that some function is not a member of Eigen::Block<...>

What am I doing wrong?

I'd appreciate any help - thank you.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can do it with the devel branch but this will be extremely slow because at each insertion Eigen will have to perform memory reallocation and numerous memory copies. Better use a row major matrix (SparseMatrix<double,ColMajor>) or the recommended triplet list.


Bookmarks



Who is online

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