BCRSMatrix: iterating over rows and accesing entries results in invalid memory access
Using a loop over the rows of a BCRSMatrix
of the form
for (auto row = m.begin(); row != m.end(); ++row) {
row[ row.index() ] = 1.0;
// m[row.index()][row.index()] = 1.0; // This is okay.
}
results in an invalid memory access reported by valgrind:
==12712== Invalid read of size 8
==12712== at 0x40408B: operator= (bvector.hh:798)
==12712== by 0x40408B: operator= (bvector.hh:1097)
==12712== by 0x40408B: main (test-bcrsmatrix-rowwise.cc:18)
==12712== Address 0xffe7d00 is 16 bytes after a block of size 80 in arena "client"
and crashes in my use of it.
The example program resulting in the valgrind output above is attached.