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

setFromTriplets fires assert on empty input for empty matrix

Tags: None
(comma "," separated)
User avatar
alecjacobson
Registered Member
Posts
26
Karma
0
It would be nice if setFromTriplets did not fire an assert (or crash at runtime) if passed an empty vector of triplets for an empty matrix.

Here's a small example:
Code: Select all
#include <Eigen/Sparse>
#include <vector>
int main(int argc,char * argv[])
{
  // Empty triplet vector
  std::vector<Eigen::Triplet<double> > IJV;
  // 0-row sparse matrix
  Eigen::SparseMatrix<double> A(0,1);
  // Assertion failed: (index >= 0 && index < size()) ...
  A.setFromTriplets(IJV.begin(),IJV.end());
  return 0;
}
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
fixed in devel branch.


Bookmarks



Who is online

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