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

startVec error

Tags: None
(comma "," separated)
lizkellogg
Registered Member
Posts
1
Karma
0

startVec error

Fri Apr 27, 2012 5:34 am
Hi,

I JUST started using Eig, today actually. I am having a really hard time just inserting values into a SparseMatrix and I was hoping someone could point out my mistake. I've searched all I could on the internet and still can't figure it out.

SparseMatrix<double,RowMajor> fr;
double val = 1;
int row = 0;
int col = 3;
fr.startVec(row);
fr.insertBack(row,col) = val;

and it fails at startVec with the error message
assertion failed: m_outerIndex[outer]==int(m_data.size()) && "You must call startVec for each inner vector sequentially"

from what i read on-line, it seemed that for column-major sparse matrices you would call startVec on the column number and iterate over rows.. In RowMajor Sparse matrices you should call startVec on the row number and iterate over columns... what am i not understanding here??

any help would be VERY much appreciated. sorry for the beginner's question..
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: startVec error

Fri Apr 27, 2012 6:28 am
Please, for sparse stuff use the alpha2 version (or even the devel version) and follow the recommendation of the tutorial. startVec is for advanced uses only.

http://eigen.tuxfamily.org/dox-devel/Tu ... rseFilling
User avatar
francoisfaure
Registered Member
Posts
4
Karma
0
OS

Re: startVec error

Wed Jun 13, 2012 8:51 pm
Hi lizkellogg,
it seems that you have not set the size of your matrix, which may explain the crash.
The following code runs fine on my Ubuntu 11.10 with Eigen 3.0.5:

Code: Select all
   
 SparseMatrix<double,RowMajor> fr(1,4);
    double val = 1;
    int row = 0;
    int col = 3;
    fr.startVec(row);
    fr.insertBack(row,col) = val;
    cerr<<"fr = "<< fr << endl;


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell