You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/07/15 08:37:20 UTC

[jira] [Assigned] (SPARK-16566) Bug in SparseMatrix multiplication with SparseVector

     [ https://issues.apache.org/jira/browse/SPARK-16566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Apache Spark reassigned SPARK-16566:
------------------------------------

    Assignee: Apache Spark

> Bug in SparseMatrix multiplication with SparseVector
> ----------------------------------------------------
>
>                 Key: SPARK-16566
>                 URL: https://issues.apache.org/jira/browse/SPARK-16566
>             Project: Spark
>          Issue Type: Bug
>          Components: MLlib
>    Affects Versions: 1.6.2
>            Reporter: Wilson
>            Assignee: Apache Spark
>
> In the org.apache.spark.mllib.linalg.BLAS.scala, the multiplication between SparseMatrix (sm) and SparseVector (sv) when sm is not transposed assume that the indices is sorted, but there is no validation to make sure that is the case, making the result returned wrongly.
> This can be replicated simply by using spark-shell and entering these commands:
> import org.apache.spark.mllib.linalg.SparseMatrix
> import org.apache.spark.mllib.linalg.SparseVector
> import org.apache.spark.mllib.linalg.DenseVector
> import scala.collection.mutable.ArrayBuffer
> val vectorIndices = Array(3,2)
> val vectorValues = Array(0.1,0.2)
> val size = 4
> val sm = new SparseMatrix(size, size, Array(0, 0, 0, 1, 1), Array(0), Array(1.0))
> val dm = sm.toDense
> val sv = new SparseVector(size, vectorIndices, vectorValues)
> val dv = new DenseVector(s.toArray)
> sm.multiply(dv) == sm.multiply(sv)
> sm.multiply(dv)
> sm.multiply(sv)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org