dmitrievanthony commented on a change in pull request #6378: IGNITE-11647: ML 
Vectors should work with all Serializable objects besides double
URL: https://github.com/apache/ignite/pull/6378#discussion_r270477186
 
 

 ##########
 File path: 
modules/ml/src/main/java/org/apache/ignite/ml/math/primitives/vector/storage/DenseVectorStorage.java
 ##########
 @@ -56,19 +61,90 @@ public DenseVectorStorage(double[] data) {
         this.data = data;
     }
 
+    /**
+     * @param data Backing data array.
+     */
+    public DenseVectorStorage(Serializable[] data) {
+        assert data != null;
+
+        this.rawData = data;
+    }
+
     /** {@inheritDoc} */
     @Override public int size() {
-        return data == null ? 0 : data.length;
+        if (data == null && rawData == null)
+            return 0;
+        else {
+            if (data != null)
+                return data.length;
+            if (rawData != null)
+                return rawData.length;
+            else
+                throw new IllegalStateException();
 
 Review comment:
   Unreachable statement?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to