Re: [eigen] Indexes: why signed instead of unsigned?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/5/11 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
> On Tue, 11 May 2010, Benoit Jacob wrote:
>
>> What about the other debate, between int (32bit) and ptrdiff_t (same
>> size as void*) ?
>
> A disadvantage of the potentially bigger ptrdiff_t is that it costs more
> memory. I guess this is usually not an issue, but it does make a difference
> for sparse matrices.

Right, I had completely overlooked the Sparse case.

Though if we agree that dense vectors may potentially be larger than
2e+9, then sparse vectors may too! In other words, the arguments in
favor of ptrdiff_t also apply to the Sparse case, only this time there
is the downside of memory usage. Maybe it's important to let the index
type be easily configurable for Sparse objects.

> In fact, we earlier had somebody who wanted to use
> 16-bit instead of 32-bit for this reason:
> http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2009/02/msg00006.html

OK so we need to make that configurable.

> The performance hit of using 64-bit indices may not be so big,

Let's be clear: ptrdiff_t is only 64bit on 64bit platforms. So it
should not give any performance hit at all. As for the memory usage
hit, it is negligible in the Dense case, it's only an issue in the
Sparse case.

> but we never
> had somebody complain about eigen using only 32-bit indices. And on a
> practical note, it seems rather short before the planned beta tagging to
> make such a radical change.

True. This is not optimal. On the other hand, releasing a beta with
int and getting people to complain about that later, would be even
worse :)

Benoit

>
> No opinion on the signed/unsigned debate.
>
>
> Jitse
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/