Matrix too big?

I'm using map< size_t, map< size_t, long double > > as a sparse matrix data structure (see for implementation details: http://www.cplusplus.com/forum/general/8352/ ).

At the moment I'm importing the discrete Laplacian into my matrix (n x n, square matrix). It has no more than 5*n non-zero elements. When n > 20000, I get a segmentation fault, i.e. at about 100,000 elements.

Any ideas on getting my matrix to hold more?
Last edited on
Buying more RAM? Although that doesn't really sound like it should cause a problem.
Just before the segfault, what's the size of the biggest inner map?
Why don't you use a single map with something like
 
std::map<std::pair<size_t, size_t>, long double>


That may be more space and time efficient.
Most rows have 5 elements, the rest of them have less than 5.

@kbw: it has to be implemented this way for fast multiplication, memory is slightly less important.
Topic archived. No new replies allowed.