commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [math] Re: Sparse matrices not supported anymore?
Date Fri, 08 Nov 2013 19:47:26 GMT
Le 08/11/2013 18:38, Thomas Neidhart a écrit :
> On 10/13/2013 09:41 AM, Ted Dunning wrote:
>> Commons math decided not to support sparse matrices due to the difficulty
>> of getting them just right.
>> The problem is that 0 * Inf = NaN, not 0.  This means that for floating
>> point math, 0 * x = x is not a true identity.
>> The problem really arises when the 0 in question could be either stored as
>> a 0 or not.  Not storing zeros is, of course, the hallmark and calling card
>> of sparse matrices because if you assume that the zero multiplication
>> identity holds, you can avoid lots of arithmetic.
>> Unfortunately, if the other matrix or vector has Inf in it, multiplying by
>> a sparse matrix where the corresponding element is missing gives a 0
>> instead of NaN.  Moreover, the dot product gives a value instead of NaN.
>> This is very hard to fix and still retain the desirable speed properties of
>> sparse matrices.  You could imagine that you have a bitmap of all of the
>> Inf values in every matrix, but keeping that bitmap up to date can
>> absolutely kill performance since you have the potential for a branch in
>> critical inner loops.
>> Most sparse matrices just punt and say they are sorry in a very
>> non-IEEE-754 sort of way.
>> Commons Math has decided instead to remove sparse matrices entirely.
> is there still consensus that we are going to remove the sparse
> implementations with 4.0?

Well, I really think it is a pity, we should support this. But lets face
it: up to now we have been unable to do it properly. Sébastien who tried
to do something in this direction has left the project and nobody
replaced him.


> Thomas
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message