Skip to content
Snippets Groups Projects
Commit c0df001f authored by Frederik Hennig's avatar Frederik Hennig Committed by Richard Angersbach
Browse files

Apply 1 suggestion(s) to 1 file(s)

parent da00b78f
No related branches found
No related tags found
1 merge request!438Reduction Support
Pipeline #78271 passed
......@@ -12,27 +12,20 @@ _available_operator_interface: set[ReductionOp] = {
def reduction_op_to_expr(op: ReductionOp, op1, op2) -> PsExpression:
if op in _available_operator_interface:
match op:
case ReductionOp.Add:
return PsAdd(op1, op2)
case ReductionOp.Sub:
return PsSub(op1, op2)
case ReductionOp.Mul:
return PsMul(op1, op2)
case ReductionOp.Div:
return PsDiv(op1, op2)
case _:
raise FreezeError(
f"Found unsupported operation type for reduction assignments: {op}."
)
else:
match op:
case ReductionOp.Min:
return PsCall(PsMathFunction(MathFunctions.Min), [op1, op2])
case ReductionOp.Max:
return PsCall(PsMathFunction(MathFunctions.Max), [op1, op2])
case _:
raise FreezeError(
f"Found unsupported operation type for reduction assignments: {op}."
)
match op:
case ReductionOp.Add:
return PsAdd(op1, op2)
case ReductionOp.Sub:
return PsSub(op1, op2)
case ReductionOp.Mul:
return PsMul(op1, op2)
case ReductionOp.Div:
return PsDiv(op1, op2)
case ReductionOp.Min:
return PsCall(PsMathFunction(MathFunctions.Min), [op1, op2])
case ReductionOp.Max:
return PsCall(PsMathFunction(MathFunctions.Max), [op1, op2])
case _:
raise FreezeError(
f"Found unsupported operation type for reduction assignments: {op}."
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment