On Wed, Feb 6, 2013 at 8:47 AM, Matthew Rocklin <[email protected]> wrote:
> When I said "rewrite rules" I meant strategies.
>
>
> On Tue, Feb 5, 2013 at 7:01 PM, Matthew Rocklin <[email protected]> wrote:
>>
>> Rewrite rules don't respect the canonicalization that happens at
>> expression construction time. If this is important to you then inject the
>> `rebuild` rule which effectively does type(x)(*map(rebuild, x.args))
>>
>> Here is my solution to your problem
OK, ,thanks. I gave it a try and it made the routing runtime increase
by about 65% I replaced this
```
if not rv.args:
return rv
args = tuple([TR10i(a) for a in rv.args])
if args != rv.args:
rv = rv.func(*args)
if not rv.is_Add:
return rv
```
with this
```
from sympy.rules import chain, rebuild, debug, typed
from sympy.rules.traverse import bottom_up
if first:
return bottom_up(chain(rebuild, typed({Add: lambda x:TR10i(x,
False)})))(rv)
```
My fu branch is pretty stable now if you want to look at it there.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.