Skip to content

Commit

Permalink
fix binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Li Pu committed Jun 13, 2014
1 parent 4c7aec3 commit eb15100
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.apache.spark.annotation.Experimental
@Experimental
case class EigenValueDecomposition[VType](s: Vector, V: VType)

@Experimental
object EigenValueDecomposition {
/**
* Compute the leading k eigenvalues and eigenvectors on a symmetric square matrix using ARPACK.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,23 @@ class RowMatrix(
RowMatrix.triuToFull(n, GU.data)
}

/**
* Computes the singular value decomposition of this matrix, using default tolerance (1e-9).
*
* @param k number of singular values to keep. We might return less than k if there are
* numerically zero singular values. See rCond.
* @param computeU whether to compute U
* @param rCond the reciprocal condition number. All singular values smaller than rCond * sigma(0)
* are treated as zero, where sigma(0) is the largest singular value.
* @return SingularValueDecomposition(U, s, V)
*/
def computeSVD(
k: Int,
computeU: Boolean = false,
rCond: Double = 1e-9): SingularValueDecomposition[RowMatrix, Matrix] = {
computeSVD(k, computeU, rCond, 1e-9)
}

/**
* Computes the singular value decomposition of this matrix.
* Denote this matrix by A (m x n), this will compute matrices U, S, V such that A ~= U * S * V',
Expand Down Expand Up @@ -281,9 +298,9 @@ class RowMatrix(
*/
def computeSVD(
k: Int,
computeU: Boolean = false,
rCond: Double = 1e-9,
tol: Double = 1e-6): SingularValueDecomposition[RowMatrix, Matrix] = {
computeU: Boolean,
rCond: Double,
tol: Double): SingularValueDecomposition[RowMatrix, Matrix] = {
val n = numCols().toInt
require(k > 0 && k <= n, s"Request up to n singular values k=$k n=$n.")

Expand Down

0 comments on commit eb15100

Please sign in to comment.