C++ example based on <rsb.hpp> assembling RsbMatrix by pieces.
- Author
- Michele Martone
#include <vector>
#include <cassert>
#include <array>
for (auto i = 0; i < nrA; ++i )
for (auto j = i-1; j <= i+1; ++j )
if ( i >= 0 && i < nrA )
if ( j >= 0 && j < ncA )
mtx.set_val((i+1)*100+(j+1),i,j);
mtx.close();
assert(mtx.nnz() == 3 * nrA - 2);
mtx.file_save(nullptr);
}
auto main() -> int
Definition: assemble.cpp:38
Class initializing/finalizing librsb state.
Definition: rsb.hpp:272
Represent a sparse matrix in RSB format by means of librsb.
Definition: rsb.hpp:532
signed int rsb_coo_idx_t
Definition: rsb.h:349
Classes RsbLib and RsbMatrix provide native C++ access to librsb.