A problem with automatic canonicalization is that it would slow down the 
construction
of big TensMul objects;
constructing the product of ``n`` tensors would require ``n - 1`` 
canonicalizations instead
of one. To avoid this, the automatic canonicalization is delayed to when 
TensMul objects
are summed.

On Friday, May 3, 2013 1:02:16 AM UTC+2, Aaron Meurer wrote:
>
> This is very similar to the automatic evaluation question that comes 
> up all the time. If you make things compare equal, then it becomes 
> impossible to distinguish them. As such, you should reasonably expect 
> any instance of one to be replaced with another by just about 
> anything. 
>
> A common way around this is to automatically canonicalize things. 
> Another (probably better) way is to just write your algorithms so that 
> they are agnostic of structural differences (in other words, 
> canonicalize at the top of your algorithms instead of in your 
> constructors). 
>
> Aaron Meurer 
>
> On Thu, May 2, 2013 at 1:43 PM, Matthew Rocklin 
> <mroc...@gmail.com<javascript:>> 
> wrote: 
> > I remember being told to never override __eq__.  In general I support 
> this 
> > policy. 
> > 
> > I often implement .equals when I need more mathematical equality 
> checking. 
> > Perhaps renaming __eq__ to .equals would be better than deletion. 
> > 
> > 
> > On Thu, May 2, 2013 at 2:39 PM, Stefan Krastanov 
> > <krastano...@gmail.com <javascript:>> wrote: 
> >> 
> >> I have found a few pieces of code where `__eq__` is extended to check 
> >> for more than structural equality and this causes some routines to 
> >> fail. Am I right to revert __eq__ to checking only for structural 
> >> equality (and fixing related tests)? 
> >> 
> >> The code in question is `tensor.py` line 1318. 
> >> 
> >> -- 
> >> 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 sympy+un...@googlegroups.com <javascript:>. 
> >> To post to this group, send email to sy...@googlegroups.com<javascript:>. 
>
> >> Visit this group at http://groups.google.com/group/sympy?hl=en-US. 
> >> 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 sympy+un...@googlegroups.com <javascript:>. 
> > To post to this group, send email to sy...@googlegroups.com<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/sympy?hl=en-US. 
> > 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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to