Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/629#discussion_r29320587 --- Diff: flink-staging/flink-ml/src/test/scala/org/apache/flink/ml/math/SparseVectorSuite.scala --- @@ -87,4 +87,33 @@ class SparseVectorSuite extends FlatSpec with Matchers { sparseVector should not equal(copy) } + + it should "calculate dot product with SparseVector" in { + val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0)) + val vec2 = SparseVector.fromCOO(4, (0, 0), (1, 1), (2, 0), (3, 1)) + + vec1.dot(vec2) should be(0) + } + + it should "calculate dot product with DenseVector" in { + val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0)) + val vec2 = DenseVector(Array(0, 1, 0, 1)) + + vec1.dot(vec2) should be(0) + } + + it should "fail in case of calculation dot product with different size vector" in { + val vec1 = SparseVector.fromCOO(4, (0, 1), (1, 0), (2, 1), (3, 0)) --- End diff -- continuous non-zero entries
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---