Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-11-20 06:00:18

On Saturday 18 November 2006 18:04, Max Weinberg wrote:
> Hello,
> it seems to be impossible to use any other type than std::size_t for the
> sparse indices. I looked at this because I wanted to extend the possible
> index range for sparse matrices/vectors by using an unlimited integer
> class.

Yes, this is a known problem. Unfortunately there is no fix yet.

I once thought about it, but have no solution. I summarize my thoughts:


matrix::size_type := IA::value_type;
matrix::difference_type := IA::difference_type;

But, one problem remains open:
how to implement prod(A,x) (and other expressions)?

most ublas expressions expect that A::size_type == x::size_type, this is even
true for iterator based algorithms because it.index() should return
IA::value_type for sparse iterators which is then used as an index into the
other container ...


matrix::size_type := size_t; // current defaults
matrix::size_type := ptr_diff_t;

Problem: can I always safely cast IA::value_type to size_t? (IMHO: No for your

I'd really like to have a solution, because using sparse matrices on 64-Bit
machines forces me to have 64-Bit integers as indices all over - but I never
expect to solve systems with 2 Mrd. of unknowns or more.