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

Joseph K. Bradley closed SPARK-16566.
-------------------------------------
    Resolution: Duplicate

Linking existing JIRA which this one is duplicating.  Could you please work 
under the other JIRA instead of this one?  Thanks!

> 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
>
> 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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to