cse_codegen.py
Go to the documentation of this file.
1 import sympy
2 import io
3 
4 
5 def cse_codegen(symbols):
6  cse_results = sympy.cse(symbols, sympy.numbered_symbols("c"))
7  output = io.StringIO()
8  for helper in cse_results[0]:
9  output.write("Scalar const ")
10  output.write(sympy.printing.ccode(helper[1], helper[0]))
11  output.write("\n")
12  assert len(cse_results[1]) == 1
13 
14  output.write(sympy.printing.ccode(cse_results[1][0], "result"))
15  output.write("\n")
16  output.seek(0)
17  return output
sophus.cse_codegen.cse_codegen
def cse_codegen(symbols)
Definition: cse_codegen.py:5


sophus
Author(s): Hauke Strasdat
autogenerated on Wed Mar 2 2022 01:01:47