Skip to content

Commit dcdf578

Browse files
committed
additional gemv tests
1 parent e4ca52d commit dcdf578

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mllib/src/test/scala/org/apache/spark/mllib/linalg/BLASSuite.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,23 @@ class BLASSuite extends SparkFunSuite {
392392
}
393393
}
394394

395+
val y17 = new DenseVector(Array(0.0, 0.0))
396+
val y18 = y17.copy
397+
398+
val sA3 = new SparseMatrix(3, 2, Array(0, 2, 4), Array(1, 2, 0, 1), Array(2.0, 1.0, 1.0, 2.0))
399+
.transpose
400+
val sA4 =
401+
new SparseMatrix(2, 3, Array(0, 1, 3, 4), Array(1, 0, 1, 0), Array(1.0, 2.0, 2.0, 1.0))
402+
val sx3 = new SparseVector(3, Array(1, 2), Array(2.0, 1.0))
403+
404+
val expected4 = new DenseVector(Array(5.0, 4.0))
405+
406+
gemv(1.0, sA3, sx3, 0.0, y17)
407+
gemv(1.0, sA4, sx3, 0.0, y18)
408+
409+
assert(y17 ~== expected4 absTol 1e-15)
410+
assert(y18 ~== expected4 absTol 1e-15)
411+
395412
val dAT =
396413
new DenseMatrix(3, 4, Array(0.0, 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 3.0))
397414
val sAT =

0 commit comments

Comments
 (0)