Baunsgaard commented on a change in pull request #1480:
URL: https://github.com/apache/systemds/pull/1480#discussion_r768110150



##########
File path: src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java
##########
@@ -5096,34 +5081,52 @@ public final MatrixBlock 
aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m
                return aggregateBinaryOperations(m1, m2, null, op);
        }
 
-       public MatrixBlock aggregateBinaryOperations(MatrixBlock m1, 
MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op) {
+       public final MatrixBlock aggregateBinaryOperations(MatrixBlock m1, 
MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op) {
                //check input types, dimensions, configuration
-               if( m1.clen != m2.rlen ) {
+               if( m1.clen != m2.rlen )
                        throw new RuntimeException("Dimensions do not match for 
matrix multiplication ("+m1.clen+"!="+m2.rlen+").");
-               }
-               if( !(op.binaryFn instanceof Multiply && op.aggOp.increOp.fn 
instanceof Plus) ) {
+               if( !(op.binaryFn instanceof Multiply && op.aggOp.increOp.fn 
instanceof Plus) )
                        throw new DMLRuntimeException("Unsupported binary 
aggregate operation: ("+op.binaryFn+", "+op.aggOp+").");
+               if(!(m1 == this || m2 == this))
+                       throw new DMLRuntimeException("Invalid 
aggregateBinaryOperatio: one of either input should be this");
+               return matrixMult(m1, m2, ret, op.getNumThreads());
+       }
+
+       public MatrixBlock matrixMult(MatrixBlock m1, MatrixBlock m2, 
MatrixBlock ret, int k){
+
+               final int rl = m1.rlen;
+               final int cl = m2.clen;
+
+               if(m1.isEmptyBlock(false) || m2.isEmptyBlock(false)) {

Review comment:
       empty return is checked once in this method, and skipped in all kernel 
calls / except native lib




-- 
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: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to