Commit a1c374cc authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add own implementation for printing an unknown function

Using the SymPy implementation for printing a `sympy.Function` has some issues:

 - you cannot use `cast_func` as an argument -> SymPy prints
 - typed numbers are not typed any more -> e.g. pow(x, 0.25) instead of
 pow(x, 0.25f)
parent c4e92d45
......@@ -385,7 +385,8 @@ class CustomSympyPrinter(CCodePrinter):
elif expr.func == int_div:
return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
return super(CustomSympyPrinter, self)._print_Function(expr)
arg_str = ', '.join(self._print(a) for a in expr.args)
return f'{}({arg_str})'
def _typed_number(self, number, dtype):
res = self._print(number)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment