Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8565#discussion_r38515156
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala 
---
    @@ -278,7 +278,8 @@ class DenseMatrix @Since("1.3.0") (
       }
     
       override def hashCode: Int = {
    -    com.google.common.base.Objects.hashCode(numRows : Integer, numCols: 
Integer, toArray)
    +    val state = Seq(numRows, numCols, Arrays.hashCode(values), 
isTransposed.hashCode)
    --- End diff --
    
    Crazy, you might ask on the breeze list if you have time, to make sure 
we're not missing something, but that seems like a valid test.
    
    We can avoid using either Breeze method in these implementations in order 
to write a version that we know is consistent and correct. On the other hand, 
it's likely that `==` is correct, and it's just that hash code isn't 
implemented. I suppose it should be possible to write a hash code that must be 
consistent with the plain meaning of equality for matrices, by making it a 
function of all (non-zero) elements and their positions or something. That is, 
is your `hashCode` going to be consistent with Breeze `==`? that's the 
important thing to guarantee.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to