Skip to content

Commit eb15100

Browse files
author
Li Pu
committed
fix binary compatibility
1 parent 4c7aec3 commit eb15100

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/EigenValueDecomposition.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.apache.spark.annotation.Experimental
3030
@Experimental
3131
case class EigenValueDecomposition[VType](s: Vector, V: VType)
3232

33+
@Experimental
3334
object EigenValueDecomposition {
3435
/**
3536
* Compute the leading k eigenvalues and eigenvectors on a symmetric square matrix using ARPACK.

mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,23 @@ class RowMatrix(
245245
RowMatrix.triuToFull(n, GU.data)
246246
}
247247

248+
/**
249+
* Computes the singular value decomposition of this matrix, using default tolerance (1e-9).
250+
*
251+
* @param k number of singular values to keep. We might return less than k if there are
252+
* numerically zero singular values. See rCond.
253+
* @param computeU whether to compute U
254+
* @param rCond the reciprocal condition number. All singular values smaller than rCond * sigma(0)
255+
* are treated as zero, where sigma(0) is the largest singular value.
256+
* @return SingularValueDecomposition(U, s, V)
257+
*/
258+
def computeSVD(
259+
k: Int,
260+
computeU: Boolean = false,
261+
rCond: Double = 1e-9): SingularValueDecomposition[RowMatrix, Matrix] = {
262+
computeSVD(k, computeU, rCond, 1e-9)
263+
}
264+
248265
/**
249266
* Computes the singular value decomposition of this matrix.
250267
* Denote this matrix by A (m x n), this will compute matrices U, S, V such that A ~= U * S * V',
@@ -281,9 +298,9 @@ class RowMatrix(
281298
*/
282299
def computeSVD(
283300
k: Int,
284-
computeU: Boolean = false,
285-
rCond: Double = 1e-9,
286-
tol: Double = 1e-6): SingularValueDecomposition[RowMatrix, Matrix] = {
301+
computeU: Boolean,
302+
rCond: Double,
303+
tol: Double): SingularValueDecomposition[RowMatrix, Matrix] = {
287304
val n = numCols().toInt
288305
require(k > 0 && k <= n, s"Request up to n singular values k=$k n=$n.")
289306

0 commit comments

Comments
 (0)