Github user MechCoder commented on a diff in the pull request:
https://github.com/apache/spark/pull/7554#discussion_r35854220
--- Diff: python/pyspark/mllib/linalg.py ---
@@ -1152,9 +1156,416 @@ def sparse(numRows, numCols, colPtrs, rowIndices,
values):
return SparseMatrix(numRows, numCols, colPtrs, rowIndices, values)
+class DistributedMatrix(object):
+ """
+ Represents a distributively stored matrix backed by one or
+ more RDDs.
+
+ """
+ def numRows(self):
+ """Get or compute the number of rows."""
+ raise NotImplementedError
+
+ def numCols(self):
+ """Get or compute the number of cols."""
+ raise NotImplementedError
+
+
+class RowMatrix(DistributedMatrix):
+ """
+ .. note:: Experimental
+
+ Represents a row-oriented distributed Matrix with no meaningful
+ row indices.
+
+ :param rows: An RDD of vectors.
+ :param numRows: Number of rows in the matrix. A non-positive
+ value means unknown, at which point the number
+ of rows will be determined by the number of
+ records in the `rows` RDD.
+ :param numCols: Number of columns in the matrix. A non-positive
+ value means unknown, at which point the number
+ of columns will be determined by the size of
+ the first row.
+ """
+ def __init__(self, rows, numRows=0, numCols=0):
+ """Create a wrapper over a Java RowMatrix."""
+ if not isinstance(rows, RDD):
+ raise TypeError("rows should be an RDD of vectors, got %s" %
type(rows))
--- End diff --
nitpick: it is enough to just say RDD's I think. since the argument need
not be vectors (right now).
---
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]