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

A vector of sparse matrices in Eigen

Tags: None
(comma "," separated)
ssniper
Registered Member
Posts
1
Karma
0
I know that a vector of dense matrices can be simply implemented with std::vector

std::vector<Eigen::DenseMatrix>

However, I need to store some sparse matrices for later computation(not the dense version to save memory), and sth like
std::vector<Eigen::SparseMatrix> doesn't work, does it violate some rules posed by the STL container vector?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Works for me:
Code: Select all
#include <vector>
#include <Eigen/SparseCore>
using namespace Eigen;
int main() {
  std::vector<SparseMatrix<double> > data;
  data.push_back(SparseMatrix<double>());
  data.resize(3);
  data[1].resize(2,2);
}


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]