My experience from building this is that there are some rules like unpack, flatten, and rmid (remove identities) which I think should remain as they are. There are some rules that I had to make for MatMul and MatAdd which could probably be made easier through a more structured rule creation system like what Aaron is discussing. xxinv is a good example of this.
The strategies I really like exactly as they are. (you should check out the definition of canon - the canonicalization strategy.) I think that the strategies should remain as pure python functions. I think that there should be some rules that are pure python functions (i.e. unpack, flatten). I tihnk that we should eventually develop some more interesting way to generate rules. My vote is pattern matching triples (from-expr, to-expr, condition) because this is what I'm used to<http://en.wikipedia.org/wiki/Maude_system> but there are lots of good options. I think that this should happen later as the result of lots of trial and error. Everything so far is very flat so it should be easy to convert existing code to some new system. Using these rules I was able to completely separate the dependence of MatrixExprs from Expr; a task that has been bothering me for a long time<http://goo.gl/ZT3nZ>. This was also a task that was supposed to be very difficult because it meant rewriting a very dense part of SymPy's core for MatrixExprs. This was done with, I believe, a minimal amount of effort once the strategies were in place. The logic for simplification is now also very testable. Every little piece of logic is separately available for unit testing. On Sat, Oct 6, 2012 at 9:41 AM, Sergiu Ivanov <[email protected]>wrote: > On Sat, Oct 6, 2012 at 2:52 PM, Matthew Rocklin <[email protected]> > wrote: > > > > So I have a basic version up right now. I added in a quick "debug" > strategy > > that prints out before and after for any change. You can track what > happens > > as the system simplifies the expression. I don't claim that SymPy's > eventual > > solution should look like what I have now. I do make the claim that I > have > > now is neat :) > > Very nice! The example looks very cool. > > > Code is up here > > https://github.com/mrocklin/sympy/tree/rr/sympy/rr > > https://github.com/mrocklin/sympy/tree/rr/sympy/matrices/expressions > > I've started looking through the code, commit-wise. Seems that > everything is very neat! And, at least up to where I have seen, you > have elegantly addressed some of the major concerns which were brought > up in this discussion (for example, the condition() function). > > Sergiu > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
