You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sébastien Brisard <se...@m4x.org> on 2012/07/07 14:31:54 UTC

[math] In class RealVector, sparseIterator() is confusing

Hi,
recent bugs have revealed that the use of sparseIterator() is quite
delicate. Also, the current Javadoc is confusing, since it says
"Specialized implementations may choose to not iterate over all
dimensions, either because those values are unset, or are equal to
defaultValue(), or are small enough to be ignored for the purposes of
iteration". This suggests that an unstored value different from zero
could be used (in fact, I have implemented RealVectorAbstractTest with
this goal in mind). However, method "defaultValue()" (mentioned in the
javadoc) does not exist, and when sparseIterators are invoked in the
current implementation of CM3, it is *always* assumed that this
default value is indeed zero.
At the very least, we need to alter the Javadoc.

I would personally be in favor of deprecating this method, at least in
the {{RealVector}} base class. I think it would make more sense to
move it to the {{SparseRealVector}} class. Also, I think that at some
point, we should have a discussion on the current implementation of
sparse vectors/matrices, since recent tests have shown flaws in the
implementation.

Looking forward to reading your thoughts on that topic,
Sébastien


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] In class RealVector, sparseIterator() is confusing

Posted by Luc Maisonobe <Lu...@free.fr>.
On 09/07/2012 02:39, Gilles Sadowski wrote:
> On Sat, Jul 07, 2012 at 02:31:54PM +0200, Sébastien Brisard wrote:
>> Hi,
>> recent bugs have revealed that the use of sparseIterator() is quite
>> delicate. Also, the current Javadoc is confusing, since it says
>> "Specialized implementations may choose to not iterate over all
>> dimensions, either because those values are unset, or are equal to
>> defaultValue(), or are small enough to be ignored for the purposes of
>> iteration". This suggests that an unstored value different from zero
>> could be used (in fact, I have implemented RealVectorAbstractTest with
>> this goal in mind). However, method "defaultValue()" (mentioned in the
>> javadoc) does not exist, and when sparseIterators are invoked in the
>> current implementation of CM3, it is *always* assumed that this
>> default value is indeed zero.
>> At the very least, we need to alter the Javadoc.
>>
>> I would personally be in favor of deprecating this method, at least in
>> the {{RealVector}} base class. I think it would make more sense to
>> move it to the {{SparseRealVector}} class. Also, I think that at some
>> point, we should have a discussion on the current implementation of
>> sparse vectors/matrices, since recent tests have shown flaws in the
>> implementation.
> 
> I agree...

+1

Luc

> 
> 
> Gilles
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] In class RealVector, sparseIterator() is confusing

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
On Sat, Jul 07, 2012 at 02:31:54PM +0200, Sébastien Brisard wrote:
> Hi,
> recent bugs have revealed that the use of sparseIterator() is quite
> delicate. Also, the current Javadoc is confusing, since it says
> "Specialized implementations may choose to not iterate over all
> dimensions, either because those values are unset, or are equal to
> defaultValue(), or are small enough to be ignored for the purposes of
> iteration". This suggests that an unstored value different from zero
> could be used (in fact, I have implemented RealVectorAbstractTest with
> this goal in mind). However, method "defaultValue()" (mentioned in the
> javadoc) does not exist, and when sparseIterators are invoked in the
> current implementation of CM3, it is *always* assumed that this
> default value is indeed zero.
> At the very least, we need to alter the Javadoc.
> 
> I would personally be in favor of deprecating this method, at least in
> the {{RealVector}} base class. I think it would make more sense to
> move it to the {{SparseRealVector}} class. Also, I think that at some
> point, we should have a discussion on the current implementation of
> sparse vectors/matrices, since recent tests have shown flaws in the
> implementation.

I agree...


Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org