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

Assertion fail when multiplying Sparse matrix times vector

Tags: None
(comma "," separated)
ibuenros
Registered Member
Posts
1
Karma
0
I am trying to run the following function:

Code: Select all
void ScalarField::LinTrans(SparseMatrix<double>* Mat, ScalarField** out){
  VectorXd tempvector(numPoints);                                                     
  tempvector=(*Mat)*(*value);
...
}


where (*value) is a VectorXd. It compiles fine, but when I run it SOMETIMES I get this error:

Code: Select all
.../Eigen/Eigen/src/Core/DenseCoeffsBase.h:391: Eigen::DenseCoeffsBase<Derived, 1>::Scalar& Eigen::DenseCoeffsBase<Derived, 1>::operator[](Eigen::DenseCoeffsBase<Derived, 1>::Index) [with Derived = Eigen::Matrix<double, -0x00000000000000001, 1>, Eigen::DenseCoeffsBase<Derived, 1>::Scalar = double, Eigen::DenseCoeffsBase<Derived, 1>::Index = long int]: Assertion `index >= 0 && index < size()' failed.


This happens about half the times I run it, and the other half it runs fine. Is this a bug? Or am I doing something I shouldn't?

Thanks
rkannan
Registered Member
Posts
3
Karma
0
I presume you've ensured the dimensions are consistent, i.e. cols of Mat = rows of *value.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
please be more specific. running your programming under a debugger to get the trace and the values of index, size(), etc.


Bookmarks



Who is online

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