Skip to content

Commit

Permalink
Add check for DenseMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
MechCoder committed May 27, 2016
1 parent 70a871d commit 0bc6a3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/pyspark/mllib/linalg/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ def tallSkinnyQR(self, computeQ=False):
R = decomp.call("R")
return QRDecomposition(Q, R)


def computeSVD(self, k, computeU=False, rCond=1e-9):
"""
Computes the singular value decomposition of the RowMatrix.
Expand Down Expand Up @@ -376,7 +375,9 @@ def multiply(self, matrix):
>>> rm.multiply(DenseMatrix(2, 2, [0, 2, 1, 3])).rows.collect()
[DenseVector([2.0, 3.0]), DenseVector([6.0, 11.0])]
"""
# TODO: Only DenseMatrices are supported on the Scala side.
if not isinstance(matrix, DenseMatrix):
raise ValueError("Only multiplication with DenseMatrix "
"is supported.")
j_model = self._java_matrix_wrapper.call("multiply", matrix)
return RowMatrix(j_model)

Expand Down Expand Up @@ -698,6 +699,9 @@ def multiply(self, matrix):
>>> mat.multiply(DenseMatrix(2, 2, [0, 2, 1, 3])).rows.collect()
[IndexedRow(0, [2.0,3.0]), IndexedRow(1, [6.0,11.0])]
"""
if not isinstance(matrix, DenseMatrix):
raise ValueError("Only multiplication with DenseMatrix "
"is supported.")
return IndexedRowMatrix(self._java_matrix_wrapper.call("multiply", matrix))


Expand Down

0 comments on commit 0bc6a3c

Please sign in to comment.