yunfengzhou-hub commented on a change in pull request #73:
URL: https://github.com/apache/flink-ml/pull/73#discussion_r836019213



##########
File path: flink-ml-core/src/main/java/org/apache/flink/ml/linalg/BLAS.java
##########
@@ -32,9 +32,31 @@ public static double asum(DenseVector x) {
     }
 
     /** y += a * x . */
-    public static void axpy(double a, DenseVector x, DenseVector y) {
+    public static void axpy(double a, Vector x, DenseVector y) {
         Preconditions.checkArgument(x.size() == y.size(), "Vector size 
mismatched.");
-        JAVA_BLAS.daxpy(x.size(), a, x.values, 1, y.values, 1);
+        if (x instanceof SparseVector) {
+            axpy(a, (SparseVector) x, y);
+        } else {
+            axpy(a, (DenseVector) x, y);
+        }
+    }
+
+    /** Computes the hadamard product of the two vectors (y = y \hdot x). */
+    public static void hDot(Vector x, Vector y) {

Review comment:
       I think it would be a good idea to replace the logic in MinMaxScaler. 
But Weibo was concerned about the performance, as the implementation would be 
changed from something like 
   ```java
   for (int i = 0; i < n; i++) {
     y[i] += a[i] * x[i];
   }
   ```
   to 
   ```java
   for (int i = 0; i < n; i++) {
     x[i] *= a[i];
   }
   for (int i = 0; i < n; i++) {
     y[i] += x[i];
   }
   ```
   Thus I would like to hear from Weibo's opinion about this replacement.




-- 
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