You might be interested in Theano and in the SymPy->Theano printers.
On Fri, Feb 7, 2014 at 6:18 PM, Vlad Seghete <[email protected]> wrote: > Last time I checked what I want to do was not possible using sympy but > several versions have come out since then, adding a few features that I > just can't get to work. > > First, what I am already doing is generating numpy arrays containing > (large) sympy expressions in each element. Currently I am evaluating these > homemade tensor expressions by iterating over the ndarray and using eval() > for each expression and to get a numeric version. This is very slow, for > obvious reasons. I would like to generate C code that evaluates these large > expressions for me. In theory, I could have a python script generate a C > file that contains one function for each element of my ndarray and then > another, handwritten C file that calls each of these functions in a loop > and populates and C array for me. However, I happened to be reading this > page here http://docs.sympy.org/latest/modules/utilities/autowrap.htmland the > first example is an autowrap of a tensor operation, so I tried > combining this with the codegen module and it worked like a charm. The > problem is, my expressions require more complicated operations, like taking > the derivative of a tensor with respect to another tensor, and I have no > clue how to use the tensor module for this. Is it even possible, or is code > generation for tensors limited to Einstein summation for now? > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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. For more options, visit https://groups.google.com/groups/opt_out.
