walterddr commented on a change in pull request #9732: [FLINK-14153][ml] Add to
BLAS a method that performs DenseMatrix and SparseVector multiplication.
URL: https://github.com/apache/flink/pull/9732#discussion_r336805138
##########
File path:
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/linalg/BLAS.java
##########
@@ -55,24 +78,34 @@ public static void axpy(double a, SparseVector x,
DenseVector y) {
* y += a * x .
*/
public static void axpy(double a, DenseMatrix x, DenseMatrix y) {
- assert x.m == y.m && x.n == y.n : "Matrix dimension
mismatched.";
+ Preconditions.checkArgument(x.m == y.m && x.n == y.n, "Matrix
dimension mismatched.");
F2J_BLAS.daxpy(x.data.length, a, x.data, 1, y.data, 1);
}
+ /**
+ * y[yOffset:yOffset+n] += a * x[xOffset:xOffset+n] .
+ */
+ public static void axpy(int n, double a, double[] x, int xOffset,
double[] y, int yOffset) {
+ F2J_BLAS.daxpy(n, a, x, xOffset, 1, y, yOffset, 1);
Review comment:
A higher level question:
Maybe it is good to clarify when to use `F2J_BLAS` vs `NATIVE_BLAS`.
I found a very [interesting
read](https://issues.apache.org/jira/browse/SPARK-21305) from SPARK's mailing
list and seems like there are some considerations regarding this.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services