src/main/java/org/apache/sysds/runtime/compress/lib/LibBinaryCellOp.java
/**
	 * matrix-matrix binary operations, MM, MV
	 * 
	 * @param m1  Input matrix in compressed format to perform the operator on using m2
	 * @param m2  Input matrix 2 to use cell-wise on m1
	 * @param ret Result matrix to be returned in the operation.
	 * @param op  Binary operator such as multiply, add, less than, etc.
	 * @return The ret matrix, modified appropriately.
	 */
matrix-matrix binary operations, MM, MV

@param m1  Input matrix in compressed format to perform the operator on using m2
@param m2  Input matrix 2 to use cell-wise on m1
@param ret Result matrix to be returned in the operation.
@param op  Binary operator such as multiply, add, less than, etc.
@return The ret matrix, modified appropriately.
matrix - matrix binary operations MM MV @param m1 Input matrix in compressed format to perform the operator on using m2 @param m2 Input matrix 2 to use cell - wise on m1 @param ret Result matrix to be returned in the operation . @param op Binary operator such as multiply add less than etc . @return The ret matrix modified appropriately .
public static MatrixBlock bincellOp(CompressedMatrixBlock m1, MatrixBlock m2, CompressedMatrixBlock ret,
		BinaryOperator op) {
		if(op.fn instanceof Minus) {
			ScalarOperator sop = new RightScalarOperator(Multiply.getMultiplyFnObject(), -1);
			m2 = m2.scalarOperations(sop, new MatrixBlock());
			return LibBinaryCellOp.bincellOp(m1, m2, ret, new BinaryOperator(Plus.getPlusFnObject()));
		}
		BinaryAccessType atype = LibMatrixBincell.getBinaryAccessType(m1, m2);
		if(m1.isOverlapping() && !(op.fn instanceof Multiply || op.fn instanceof Divide)) {
			if(op.fn instanceof Plus || op.fn instanceof Minus) {
				return binaryMVPlusStack(m1, m2, ret, op);
			}
			else {
				throw new NotImplementedException(op + " not implemented for CLA");
			}
		}
		else {
			switch(atype) {
				case MATRIX_ROW_VECTOR:
					return binaryMVRow(m1, m2, ret, op);
				case OUTER_VECTOR_VECTOR:
					if(m2.getNumRows() == 1 && m2.getNumColumns() == 1) {
						return LibScalar.scalarOperations(new RightScalarOperator(op.fn, m2.quickGetValue(0, 0)),
							m1,
							ret,
							m1.isOverlapping());
					}
				default:
					LOG.warn("Inefficient Decompression for " + op + "  " + atype);
					MatrixBlock m1d = m1.decompress();
					return m1d.binaryOperations(op, m2, ret);
			}
		}
	}
public static MatrixBlock bincellOp ( CompressedMatrixBlock m1 , MatrixBlock m2 , CompressedMatrixBlock ret , BinaryOperator op ) { if ( op . fn instanceof Minus ) { ScalarOperator sop = new RightScalarOperator ( Multiply . getMultiplyFnObject ( ) , - 1 ) ; m2 = m2 . scalarOperations ( sop , new MatrixBlock ( ) ) ; return LibBinaryCellOp . bincellOp ( m1 , m2 , ret , new BinaryOperator ( Plus . getPlusFnObject ( ) ) ) ; } BinaryAccessType atype = LibMatrixBincell . getBinaryAccessType ( m1 , m2 ) ; if ( m1 . isOverlapping ( ) && ! ( op . fn instanceof Multiply || op . fn instanceof Divide ) ) { if ( op . fn instanceof Plus || op . fn instanceof Minus ) { return binaryMVPlusStack ( m1 , m2 , ret , op ) ; } else { throw new NotImplementedException ( op + " not implemented for CLA" ) ; } } else { switch ( atype ) { case MATRIX_ROW_VECTOR : return binaryMVRow ( m1 , m2 , ret , op ) ; case OUTER_VECTOR_VECTOR : if ( m2 . getNumRows ( ) == 1 && m2 . getNumColumns ( ) == 1 ) { return LibScalar . scalarOperations ( new RightScalarOperator ( op . fn , m2 . quickGetValue ( 0 , 0 ) ) , m1 , ret , m1 . isOverlapping ( ) ) ; } default : LOG . warn ( "Inefficient Decompression for " + op + "  " + atype ) ; MatrixBlock m1d = m1 . decompress ( ) ; return m1d . binaryOperations ( op , m2 , ret ) ; } } }
matrix-matrix binary operations, MM, MV
matrix - matrix binary operations MM MV
// Verify if it is okay to include all OuterVectorVector ops here.