The code I post has still some missing features. Differences in substitutions orders between both cse functions result in different subexpression groups. Due to that many cse unit tests fail with fast_cse.
I'm now reworking on add and mul cse. This is a much harder task. I'm working on it, and I hope to come with a complete fast_cse. Only after that, I can truly compare cse and fast_cse, both in returns and times. Cristóvão On Thu, Jul 4, 2013 at 8:54 PM, Aaron Meurer <[email protected]> wrote: > What are the differences between your fast_cse() and SymPy's cse()? Is there > any reason why it shouldn't just replace cse(), or at least add some options > to cse() to change the behavior. Having cse() be fast is important, as the > whole point of the function is to use it on very large expressions. > > Aaron Meurer > > > On Thu, Jul 4, 2013 at 11:39 AM, Ondřej Čertík <[email protected]> > wrote: >> >> Hi Cristóvão, >> >> >> >> On Thu, Jul 4, 2013 at 6:55 AM, Cristóvão Sousa <[email protected]> wrote: >> > Ok, I think it makes sense to continue the posts from >> > https://groups.google.com/forum/#!topic/pydy/PjZ9SP8PYDA here. >> > >> > I've implement a fast_cse() with the ideas I had. >> > >> > code: https://gist.github.com/cdsousa/a3dd16fea7c0bd27f07a >> > ipynb example: https://gist.github.com/cdsousa/e404a692e268e8df18de >> >> This is awesome, thanks for sharing it. >> >> > >> > It is still incomplete (see todo at top of code). >> > >> > Compared to current sympy cse, my routine does not revisit the whole >> > subexpression tree if it has already been seen, >> > so it can set 'to_eliminate' top duplicated subexpressions only, thus >> > there >> > is no need to '_remove_singletons()'. >> > Also, instead of using 'subs()' on the expressions, it recreates the >> > whole >> > tree replacing operation 'args' that are 'to_eliminate' with symbols (I >> > will >> > look inside subs() to better implement this). >> > >> > I'll keep working. >> >> I can help you write a pull request so that we can include this in sympy. >> This >> is a very useful addition. Let me know if you need any help. >> >> Ondrej >> >> -- >> 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 a topic in the > Google Groups "sympy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sympy/mNsEVVLFVGU/unsubscribe. > To unsubscribe from this group and all its topics, 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.
