Yep, that makes sense, unfortunately, that's not what the code was doing. equivalent() was doing that, but equals() in DenseVector also considered the name property so that sparse.equals(dense) != dense.equals(sparse). I also changed the hashCode to hash off of the entries in the container instead of the underlying data structure so that if sparse.equals(dense), then sparse.hashCode() == dense.hashCode().
Cheers, Mark On Wed, Aug 5, 2009 at 7:38 AM, Grant Ingersoll <gsing...@apache.org> wrote: > Thanks, Mark. I will look into it. I know at the time I wrote them, I > made an explicit departure from it, but I need to revisit why I did. I seem > to recall it having to do with the arrays and with the fact that we want > equals() to work like List.equals(), namely that a DenseVector and a > SparseVector containing the same values in the same positions should be > equal. > > > On Aug 4, 2009, at 1:12 PM, Mark Desnoyer wrote: > > Hi, >> >> I found an inconsistency where equals() and hashCode() didn't conform to >> the >> Java standard for SparseVector vs. DenseVector. A patch has been submitted >> to: https://issues.apache.org/jira/browse/MAHOUT-159 >> >> -Mark >> > >