On Sat, Oct 6, 2012 at 10:19 PM, Aaron Meurer <[email protected]> wrote: > On Oct 6, 2012, at 11:40 AM, Sergiu Ivanov <[email protected]> wrote: >> >> Oh. I'm slightly upset to find out that matrix expressions don't fit >> nicely within Expr; I thought Expr should represent a general >> expression. I believe I just have to read more code; sorry for >> off-topic :-) > > Yes, it's a big issue. We need the ability for objects to define for > themselves how they should be processed under Add and Mul, but it > requires some kind of dispatch system. > > Even now, this still won't work if someone tries to use MatrixExprs > with some function that calls Mul or Add on the args at some point, > because that will bypass the rules and still call Mul.flatten or > Add.flatten.
I'll just raise an (open) question: how practically feasible would it be to attempt to address this issue using the rewriting rule system which is currently being developed? I don't expect anyone to have definite answers, but I'd definitely be glad to hear opinions (perhaps in a separate thread). The reason I ask this question is that, apparently, the functionality in Mul and Add can be viewed as consisting of roughly two parts: one which is quite general (like flatten), and we can actually see it appearing in MatMul and MatAdd rules already, and the other one which is more specialised and due to which matrix expressions cannot fit into Expr. Therefore, I'm wildly supposing that it should be possible to split Mul and Add into the corresponding halves, at least one of which (the more general half) can apparently be done using rewriting rules. 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.
