Beispiel #1
0
 def exitNode(self, node, data):
     """Replace a node if it's a unary function."""
     ans = super().exitNode(node, data)
     if type(ans) is EXPR.UnaryFunctionExpression:
         return EXPR.UnaryFunctionExpression(
             ans.args, ans.getname(), casadi_intrinsic[ans.getname()])
     return ans
Beispiel #2
0
 def visit(self, node, values):
     """Replace a node if it's a unary function."""
     if type(node) is EXPR.UnaryFunctionExpression:
         return EXPR.UnaryFunctionExpression(
                         values[0],
                         node._name,
                         casadi_intrinsic[node._name])
     return node