Along the way to a patch for MAHOUT-379, I'm having some trouble figuring out SequentialAccessSparseVector.DenseVector. I think it can be simplified, but unless I'm misunderstanding there are several bugs here. I'd like to find my mistake or else simplify/fix this along the way.
get() uses offset and index, both initialized to the 'ind' argument, which is an index into the vector, not an offset into the mapping array. But then "cur = indices[index]" is compared against offset, which seems incorrect. On a related note in the Iterator's next() method we have element.offset = offset++; But this makes the two values forever inequal by one, which doesn't sound right? they start off equal at 0. I could be mistaken, but I also wonder whether this can be dramatically simplified by a single Element implementation which both understands its logical index into the vector, and offset into the mapping array if applicable.