-
- Downloads
[SPARK-17721][MLLIB][ML] Fix for multiplying transposed SparseMatrix with SparseVector
## What changes were proposed in this pull request? * changes the implementation of gemv with transposed SparseMatrix and SparseVector both in mllib-local and mllib (identical) * adds a test that was failing before this change, but succeeds with these changes. The problem in the previous implementation was that it only increments `i`, that is enumerating the columns of a row in the SparseMatrix, when the row-index of the vector matches the column-index of the SparseMatrix. In cases where a particular row of the SparseMatrix has non-zero values at column-indices lower than corresponding non-zero row-indices of the SparseVector, the non-zero values of the SparseVector are enumerated without ever matching the column-index at index `i` and the remaining column-indices i+1,...,indEnd-1 are never attempted. The test cases in this PR illustrate this issue. ## How was this patch tested? I have run the specific `gemv` tests in both mllib-local and mllib. I am currently still running `./dev/run-tests`. ## ___ As per instructions, I hereby state that this is my original work and that I license the work to the project (Apache Spark) under the project's open source license. Mentioning dbtsai, viirya and brkyvz whom I can see have worked/authored on these parts before. Author: Bjarne Fruergaard <bwahlgreen@gmail.com> Closes #15296 from bwahlgreen/bugfix-spark-17721.
Showing
- mllib-local/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala 6 additions, 2 deletions...ocal/src/main/scala/org/apache/spark/ml/linalg/BLAS.scala
- mllib-local/src/test/scala/org/apache/spark/ml/linalg/BLASSuite.scala 17 additions, 0 deletions...src/test/scala/org/apache/spark/ml/linalg/BLASSuite.scala
- mllib/src/main/scala/org/apache/spark/mllib/linalg/BLAS.scala 6 additions, 2 deletions...b/src/main/scala/org/apache/spark/mllib/linalg/BLAS.scala
- mllib/src/test/scala/org/apache/spark/mllib/linalg/BLASSuite.scala 17 additions, 0 deletions.../test/scala/org/apache/spark/mllib/linalg/BLASSuite.scala
Loading
Please register or sign in to comment