Nico,

That's probably the quickest way to get the result you want. You can also
try sublclassing the C printer and/or modifying the code generators to
override the necessary parts to print the C++ you want.

If you share some of the code that you are using we can comment more
specifically.


Jason
moorepants.info
+01 530-601-9791

On Wed, Jun 24, 2015 at 4:23 AM, Nico <[email protected]> wrote:

> Hi everyone,
>
> I'd like to convert a Python function that returns an array, e.g.,
>
> def test(x, y, z):
>      return [[x, y], [y, z]]
>
> into C++ code, e.g., a function that returns a
> std::vector<std::vector<double>>. Right now, I call `test()` with SymPy
> symbols `x`, `y`, `z`, then translate every entry into C code using
> codegen, and then after that _regexp_ the function body out. Then from the
> four function bodies, I build the C++ function.
>
> Is there a better way to do this, in particular one that works without
> regexping around the output code?
>
> Cheers,
> Nico
>
> --
> 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 http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/41d60169-a7e0-49f9-9ef6-0c790bf5c7d9%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/41d60169-a7e0-49f9-9ef6-0c790bf5c7d9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAP7f1AgFfrqsGCDinUTEce%2BMWyv%2BMxx-9uUKVpb2SJXbBayHFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to