You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Grant Ingersoll <gs...@apache.org> on 2009/08/08 20:30:30 UTC

Sparse Vector, OrderedIndDoubleMapping and zeros

Any one looked at what happens when you do:

SparseVector vec = new...
...
vec.set(2, 0.0);

Iterate over non zeros?  In looking at the code, it doesn't seem like  
it is going to handle it correctly?  I'll try to find some time to  
write up a test case.

-Grant

Re: Sparse Vector, OrderedIndDoubleMapping and zeros

Posted by Ted Dunning <te...@gmail.com>.
What is correct here?  What is exactly zero?

Iterate over non-zeros should not be required to guarantee that no zero
elements are returned, it is just saying that you don't mind missing out on
zero elements.

It is fine if set looks at the value being set and decides not to create a
new slot if the value is zero.  It is also fine if it just zeros out a
previous entry.

Iterate non-zeros should probably just iterate through all slots without
examining the values.

On Sat, Aug 8, 2009 at 11:30 AM, Grant Ingersoll <gs...@apache.org>wrote:

> Iterate over non zeros?  In looking at the code, it doesn't seem like it is
> going to handle it correctly?  I'll try to find some time to write up a test
> case.




-- 
Ted Dunning, CTO
DeepDyve