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

    https://github.com/apache/spark/pull/5232#discussion_r27534797
  
    --- Diff: python/pyspark/mllib/linalg.py ---
    @@ -634,6 +634,17 @@ def toArray(self):
             """
             return self.values.reshape((self.numRows, self.numCols), order='F')
     
    +    def __getitem__(self, indices):
    +        i = indices[0]
    +        j = indices[1]
    +        if i > self.numRows:
    +            raise ValueError("Row index %d should not be greater than 
numRows %d." %
    +                             (i, self.numRows))
    +        if j > self.numCols:
    +            raise ValueError("Column index %d should not be greater than 
numCols %d." %
    +                             (i, self.numCols))
    +        return self.values[i * self.numCols + j]
    --- End diff --
    
    This is wrong. We use column-major. So it should be `i + j * self.numRows`.


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