Registered Member
|
I keep getting that assertion failure when I run my code. Can anyone tell me whats wrong here? The code is a simple forward substitution function:
And the error at runtime is: rich@rich-VirtualBox:~/workspace/linalgtest/Debug$ ./linalgtest linalgtest: /usr/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h:407: 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. Aborted (core dumped) |
Registered Member
|
You need to specify the size of the vector x. If you declare x as you did, it will be an empty vector (a vector of length 0), so you get an error when you try to access its first element.
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]