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

    https://github.com/apache/spark/pull/416#discussion_r11668750
  
    --- Diff: 
examples/src/main/scala/org/apache/spark/examples/LocalKMeans.scala ---
    @@ -58,10 +59,21 @@ object LocalKMeans {
         bestIndex
       }
     
    +  // TODO: Make this a part of the Vector
    +  def squaredDist(a: Vector[Double], b: Vector[Double]): Double = {
    +    var ans = 0.0
    +    var i = 0
    +    while (i < a.length) {
    +      ans += (a(i) - b(i)) * (a(i) - b(i))
    +      i += 1
    +    }
    +    ans
    +  }
    +
       def main(args: Array[String]) {
         val data = generateData
    -    var points = new HashSet[Vector]
    -    var kPoints = new HashMap[Int, Vector]
    +    var points = new HashSet[Vector[Double]]
    --- End diff --
    
    It would be better if you import `scala.collection.mutable` and use 
`mutable.HashSet` and `mutable.HashMap`. Again, this is not related to this PR 
...


---
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.
---

Reply via email to