You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
Hi everyone,
I have some sympy code that generates Fortran code, and was wondering
if there a good way of simplifying the sympy expressions in order to
minimize the number of floating point operations that are required to
evaluate them numerically. Any suggestions?
Thanks,
Matt
Aaron Meurer
unread,
Jul 26, 2012, 7:19:39 PM7/26/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
One thing you can try is to use the cse() function to group common
subexpressions so that they are only evaluated once.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
SymPy may be able to help by counting operations in a given expression. I don't think you want it controlling the optimization search though.
I'm not very familiar with the relevant modules but I don't think it will be easy to perform this optimization within SymPy. To the best of my knowledge It is not easy to separate out the simplification rules and choose whether or not to apply each of them.
If you haven't already I recommend asking a non-sympy-specific version of this question on scicomp.stackexchange.com
Matthew Emmett
unread,
Jul 27, 2012, 7:32:19 AM7/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
Thanks Aaron and Matthew, I will take a look at the cse routine and
consider asking a general version of this on the scicomp site.
Matt
Vinzent Steinberg
unread,
Jul 28, 2012, 9:31:10 AM7/28/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
There is Ignition [1], which uses Sympy for optimizing numerical expressions. See for example Andy's paper [2].
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
There is also the Theano project which is all about code generation on array expressions. They've optimized a lot of this stuff much more than SymPy has. It's a bit harder to get out a single code snippet with them though. They generate working C and CUDA code and then wrap it into python functions under the hood.
--
You received this message because you are subscribed to the Google Groups "sympy" group.