From: Kasper Peeters (kasper.peeters_at_[hidden])
Date: 2004-10-05 03:37:34


Hi,

I need to handle extremely large sparse matrices, of approximately
half a million square elements (with, typically, on the order of 5
million non-zero entries).

The following, however, fails on a machine where std::size_t is 4
bytes long:

   #include <boost/numeric/ublas/matrix_sparse.hpp>
   
   int main () {
       using namespace boost::numeric::ublas;
       sparse_matrix<double> m(400000, 400000);
   }

It fails with

   Assertion failed in file
   boost/numeric/ublas/functional.hpp at line 1345:

   (size1 * size2) / size1 == size2

Obviously, while both size1 and size2 fit in a 4-byte integer, the
product does not, the calculation overflows, and this check fails.

Can this problem be circumvented without modifying boost?

Kasper