zhipeng93 commented on code in PR #242:
URL: https://github.com/apache/flink-ml/pull/242#discussion_r1226064974
##########
flink-ml-servable-core/src/main/java/org/apache/flink/ml/linalg/Vector.java:
##########
@@ -24,29 +24,29 @@
import java.io.Serializable;
-/** A vector of double values. */
+/** A vector representation of numbers. */
@TypeInfo(VectorTypeInfoFactory.class)
@PublicEvolving
-public interface Vector extends Serializable {
+public interface Vector<K extends Number, V extends Number> extends
Serializable {
/** Gets the size of the vector. */
- int size();
+ K size();
/** Gets the value of the ith element. */
- double get(int i);
+ V get(K i);
/** Sets the value of the ith element. */
- void set(int i, double value);
+ void set(K i, V value);
- /** Converts the instance to a double array. */
- double[] toArray();
+ /** Converts the instance to a primitive array. */
+ Object toArray();
/** Converts the instance to a dense vector. */
- DenseVector toDense();
+ Vector<K, V> toDense();
/** Converts the instance to a sparse vector. */
- SparseVector toSparse();
+ Vector<K, V> toSparse();
Review Comment:
I have overrode the return type in `IntDoubleVector` and `LongDoubleVector`,
since for different instances `toSparse` should return different types of
vectors.
We can talk about this offline.
--
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]