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

    https://github.com/apache/spark/pull/88#discussion_r10773101
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/linalg/SVD.scala ---
    @@ -73,19 +170,110 @@ object SVD {
      * U is m x k and satisfies U'U = eye(k)
      * V is n x k and satisfies V'V = eye(k)
      *
    - * All input and output is expected in sparse matrix format, 0-indexed
    - * as tuples of the form ((i,j),value) all in RDDs using the
    - * SparseMatrix class
    + * The return values are as lean as possible: an RDD of rows for U,
    + * a simple array for sigma, and a dense 2d matrix array for V
      *
    - * @param matrix sparse matrix to factorize
    + * @param matrix dense matrix to factorize
      * @param k Recover k singular values and vectors
    - * @return Three sparse matrices: U, S, V such that A = USV^T
    + * @return Three matrices: U, S, V such that A = USV^T
      */
    -  def sparseSVD(
    -      matrix: SparseMatrix,
    -      k: Int)
    -    : MatrixSVD =
    -  {
    + private def denseSVD(matrix: RDD[Array[Double]]) : 
    +               (RDD[Array[Double]], Array[Double], Array[Array[Double]])  
= {
    +    val n = matrix.first.size
    +
    +    if (k < 1 || k > n) {
    +      throw new IllegalArgumentException(
    +        "Request up to n singular values k=$k n=$n")
    +    }
    +
    +    // Compute A^T A
    +    val fullata = matrix.mapPartitions { iter => 
    +      val miniata = Array.ofDim[Double](n, n)
    +      while(iter.hasNext) {
    +          val row = iter.next 
    +          var i = 0
    +          while(i < n) {
    --- End diff --
    
    done


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

Reply via email to