10 std::vector<Eigen::Triplet<real_t>> content;
11 for(
int i = 0; i < rows; ++i) {
13 for(
int j = 0; j < nonzeros_per_row; ++j) {
14 content.emplace_back(i, rand() % cols, 1.f);
17 matrix.setFromTriplets(begin(content), end(content));
18 matrix.makeCompressed();
SparseFeatures make_uniform_sparse_matrix(int rows, int cols, int non_zeros_per_row)
Creates a sparse matrix with the given number of rows and columns.
types::SparseRowMajor< real_t > SparseFeatures
Sparse Feature Matrix in Row Major format.