weibozhao commented on code in PR #133:
URL: https://github.com/apache/flink-ml/pull/133#discussion_r928823700


##########
flink-ml-core/src/test/java/org/apache/flink/ml/linalg/SparseVectorTest.java:
##########
@@ -47,6 +49,16 @@ public void testConstructor() {
         assertArrayEquals(indices, vector.indices);
         assertArrayEquals(values, vector.values, 1e-5);
         assertEquals("(4, [0, 2, 3], [0.1, 0.3, 0.4])", vector.toString());
+
+        Map<Integer, Double> map = new HashMap<>(4);
+        map.put(0, 0.1);
+        map.put(2, 0.3);
+        map.put(3, 0.4);
+        SparseVector mapVector = Vectors.sparse(n, map);
+        assertEquals(n, mapVector.n);
+        assertArrayEquals(indices, mapVector.indices);
+        assertArrayEquals(values, mapVector.values, 1e-5);
+        assertEquals("(4, [0, 2, 3], [0.1, 0.3, 0.4])", mapVector.toString());

Review Comment:
   In map constructor, indices are keys in map. There is no possible existing 
duplicated indices.
   
   1 and 3  has refined.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to