On Tue, Jul 10, 2012 at 6:10 PM, Chris Smith <smi...@gmail.com> wrote:
> On Tue, Jul 10, 2012 at 9:55 AM, Sergiu Ivanov
> <unlimitedscol...@gmail.com> wrote:
>> On Tue, Jul 3, 2012 at 6:32 PM, Sergiu Ivanov
>> <unlimitedscol...@gmail.com> wrote:
>>> On Tue, Jul 3, 2012 at 4:03 PM, Matthew Rocklin <mrock...@gmail.com> wrote:
>>>> I've found that sorting the args at creation time solves lots of problems. 
>>>> I
>>>> have not found that this sorting causes any performance issues in SymPy.
>>>> Sorting is fairly efficient and no one uses FiniteSets for huge sets.
>>>
>>> I will make the confession that it's not the first time that I think
>>> that dropping initial element sorting in FiniteSet wasn't probably
>>> that very cool an idea performance-wise.
>>
>> I guess the time has come to bump this thread :-)
>>
>> I will remind the essence of the matter.  Some time ago the
>> constructor of FiniteSet has been modified to _not_ sort .args.  This
>> has created the necessity to explicitly sort FiniteSet's on many
>> occasions.
>
> Other than printing, what are these situations? Perhaps there is a
> non-sorting way to solve the problem.

Aside from setting up the sort key, it is about getting the complement
of a FiniteSet of reals.

I know these are not the most widely used scenarios, this is why I
didn't really complain before.

>> Currently, however, I have run in yet another occasion where arbitrary
>> ordering of FiniteSet's comes in the way.  FiniteSet relies on
>> Basic.sort_key to construct the sort key.  Basic.sort_key, in its
>> turn, traverses .args and creates a sort key which _depends_ on the
>> ordering of .args.
>
> I modified pre and post order traversals to use a sort key (so the
> incoming expression doesn't have to have args presorted). Would this
> help? I no longer have a pull request with it because I haven't solved
> the solve and cse randomization failures, but if you want to pull off
> that single commit it is in my rand branch.

I must confess I don't know what you refer to when you say "pre and
post order traversals" (I mean, I'm not sure what exactly it's about
in SymPy), but I'll check out your modifications later today and see
whether that helps.

Sergiu

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to