zhipeng93 commented on code in PR #134:
URL: https://github.com/apache/flink-ml/pull/134#discussion_r928874289


##########
flink-ml-core/src/main/java/org/apache/flink/ml/linalg/SparseVector.java:
##########
@@ -56,6 +56,16 @@ public double get(int i) {
         return 0.;
     }
 
+    @Override
+    public void set(int i, double value) {
+        int pos = Arrays.binarySearch(indices, i);
+        if (pos < 0) {
+            throw new IllegalStateException(
+                    "Cannot set value for a SparseVector that does not contain 
value at that dimension.");

Review Comment:
   Good catch. I agree that as long as `i is in [0,n)`, the `set()` should 
succeed. I have updated the code in the lastest commit.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to