Skip to content

Commit

Permalink
[MINOR] BinaryOp change to switch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Feb 3, 2025
1 parent a6d8bc0 commit aa4ce0b
Showing 1 changed file with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions src/main/java/org/apache/sysds/hops/BinaryOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1154,20 +1154,49 @@ && getInput().get(0) == that2.getInput().get(0)
}

public boolean supportsMatrixScalarOperations() {
return ( op==OpOp2.PLUS ||op==OpOp2.MINUS
||op==OpOp2.MULT ||op==OpOp2.DIV
||op==OpOp2.MODULUS ||op==OpOp2.INTDIV
||op==OpOp2.LESS ||op==OpOp2.LESSEQUAL
||op==OpOp2.GREATER ||op==OpOp2.GREATEREQUAL
||op==OpOp2.EQUAL ||op==OpOp2.NOTEQUAL
||op==OpOp2.MIN ||op==OpOp2.MAX
||op==OpOp2.LOG ||op==OpOp2.POW
||op==OpOp2.AND ||op==OpOp2.OR ||op==OpOp2.XOR
||op==OpOp2.BITWAND ||op==OpOp2.BITWOR ||op==OpOp2.BITWXOR
||op==OpOp2.BITWSHIFTL ||op==OpOp2.BITWSHIFTR);
switch(op) {
case PLUS:
case MINUS:
case MULT:
case DIV:
case MODULUS:
case INTDIV:
case LESS:
case LESSEQUAL:
case GREATER:
case GREATEREQUAL:
case EQUAL:
case NOTEQUAL:
case MIN:
case MAX:
case LOG:
case POW:
case AND:
case OR:
case XOR:
case BITWAND:
case BITWOR:
case BITWXOR:
case BITWSHIFTL:
case BITWSHIFTR:
return true;
default:
return false;
}
}

public boolean isPPredOperation() {
switch(op){
case LESS:
case LESSEQUAL:
case GREATER:
case GREATEREQUAL:
case EQUAL:
case NOTEQUAL:
return true;
default :
return false;
}
return (op==OpOp2.LESS ||op==OpOp2.LESSEQUAL
||op==OpOp2.GREATER ||op==OpOp2.GREATEREQUAL
||op==OpOp2.EQUAL ||op==OpOp2.NOTEQUAL);
Expand Down

0 comments on commit aa4ce0b

Please sign in to comment.