Status: New Owner: ---- Labels: Type-Defect Priority-Medium New issue 1463 by Toon.Verstraelen: Initial codegen implementation http://code.google.com/p/sympy/issues/detail?id=1463
I've tried to send the message below to sympy-patches, but it doesn't seem to get through. Hi, This is my first attempt to use the sympy-patches list. The attached patch is a proposal for the code generator for sympy, and includes working tests. The current possibilities are intentionally very limited, but the code should be extensible with future patches to handle the more complex cases of interest. The friendly interface is the codegen function, and works like this: xyz = symbols("xyz") codegen([("fn",(x+y)*z)], "C", "codegen") This writes two files: codegen.h: /****************************************************************************** * Code generated with sympy 0.6.5-git * * * * See http://www.sympy.org/ for more information. * * * * This file is part of 'project' * ******************************************************************************/ #ifndef PROJECT__CODEGEN__H #define PROJECT__CODEGEN__H double test(double x, double y, double z); #endif codegen.c: /****************************************************************************** * Code generated with sympy 0.6.5-git * * * * See http://www.sympy.org/ for more information. * * * * This file is part of 'project' * ******************************************************************************/ #include "codegen.h" #include <math.h> double test(double x, double y, double z) { return z*(x + y); } The codegen function is based a more complex api with more possibilities. More info can be found as comments and the doc strings. Any comments are appreciated. (coding style, typo's, code design, milestones, ...) cheers, Toon Attachments: 0001-Initial-codegen-implementation.patch.gz 6.0 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to sympy-issues@googlegroups.com To unsubscribe from this group, send email to sympy-issues+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en -~----------~----~----~----~------~----~------~--~---