A cppcode would be useful to have for things like this (or just a flag to ccode if the differences are minor).
Aaron Meurer On Fri, May 13, 2016 at 4:17 PM, Jason Moore <[email protected]> wrote: > You can subclass the CCodePrinter and change the method for sympy.I to print > as you like. Examples are here: > http://docs.sympy.org/latest/modules/printing.html > > > Jason > moorepants.info > +01 530-601-9791 > > On Thu, May 12, 2016 at 8:01 PM, chaowen guo <[email protected]> wrote: >> >> Hi: >> >> The output of sympy.ccode(1+sympy.I) is '1+I' >> >> However, in c++14 mode, like g++ -std=c++14 source.cpp, the g++ compiler >> does not think I is the imaginary unit. >> >> But in the http://en.cppreference.com/w/cpp/numeric/complex, I know that >> after >> >> using namespace std::complex_literals; >> I can use 1i to represent the imaginary unit. >> >> So how to tell ccode not to convert sympy.I into I but 1i? >> >> I just know that there just exists ccode to convert sympy expression into >> c code. But I can not find any cppcode to convert sympy expression into c++ >> code. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/4177732d-3956-4f12-b2b9-7edc27e845a4%40googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAP7f1AiF55f8Q2hm%2BK27E39-HS%3DGL5VKxqNUcJrzEhKE_fbHbQ%40mail.gmail.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6K0Yyez1ThK6WLwwubVX%2B%3D3x%2B2OFd96-sx1sN%3DFUxvm3g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
