-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polyhedron and combinatorics; evalf(1); quick_sort; Basic.copy() #1508
Conversation
I'll take a look at this as soon as I have some free time : ) |
Thanks! |
Why is this against 0.7.2? |
rv.extend([[i] for i in sorted(need)]) | ||
return rv | ||
|
||
def cyclic_form1(cyclic_form0, singletons=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any merit to having full_cyclic_form1 and/or cyclic_form0 defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like they were added for convenience so when someone wants to enter notation as it appears in a book, for example, that is 1-based with singletons omitted, and see the result in the same form, they can do
p = Permutation(full_cyclic_form1(what_I_see, size))
...do something
print cyclic_form1(p.cyclic_form)
The full_cycle_form0
is also needed because Permutation requires that all indices be present whereas standard notation allows singletons to be omitted. Perhaps methods could be modifed to use a sparse-permutation storage and then it wouldn't matter if they used 1-based or 0-based notation.
I haven't been following things too closely, so my feedback is quite shallow unfortunately. One further meta comment I had was about |
xrange vs. range doesn't matter that much. If it's potentially big, use xrange. And obviously if you need to index it, use range. |
Because I was hoping to have it be part of 0.7.2 to fill out the combinatorics changes that were already made. |
xrange has been changed to range. question to self: is range indexable in 3.3 or does it return an iterator? |
ok, range(10, 20, 2)[3] works in 3.x |
There are going to be failures because of the R to L multiplication change. I'll work these out but am leaving this open for any other comments. |
I think things are ok after all. |
Unless this has a significant API change, it would be better to merge this into master. 0.7.2 should only have bug fixes or major API changes that would rather not wait a release, so that it can stabilize. |
Sorry to be a stickler about it, but if we only released when there are no new patches coming in, then we would never release (this is almost what is happening already). |
No problem either way, but here's what's happened so you can decide which way you want this to go:
Perhaps 1 and 2 could go in now? We're still discussing the current behavior of how Permutations are multiplied and if a change is made there it's going to be major. |
I can close this and reopen 1498. I'll wait for your advice, @asmeurer . |
I think if anything we should try to finalize the Permutation convention before the release, especially if we are going to change it. But how soon can it be done? |
What is the benefit of quick_sort, is it really that much faster than |
It uses hash sorting and if there are no clashes, you are done. This has |
I know there is a test failure in the demonstration of using DisjointCycle multiplication because I'm floundering with the class construction. I would like DisjointCycle and BaseDisjointCycle (should be renamed to put Base at the end) to be merged together if possible -- but not sure that it is possible -- and I want the returned object to come back as DisjointCycle, not defaultdict and I'm not sure how to get that done. Can anyone see what I'm trying to do and give me a hand? @ness01 , perhaps, or anyone else that is fluent in object creation? |
I'm sorry, but it is unclear to me what you are trying to do. The following merges BaseDisjointCycle and DisjointCycle, and creates the constructor you like, plus copying:
Note that it is not obvious to me if this is particularly pythonic style. In any case, what is the difference between the BaseDisjointCycle class and the Permutation class? Note that the product of two cycles need not be a cycle, so I suppose BaseDisjointCycle is a representation of a permutation in disjoint cycle form, plus multiplication in reversed order? And interpretation of iterables as cycles? If this is the case, I would suggest that the concerns should be separated: (1) a method (not necessarily in the python sense) to reverse multiplication order, (2) a method (in the python sense) to display the disjoint cycles of a permutation, (3) a method (not necessarily in the python sense) to interpret iterables as cycles, and (4) possibly a redesign of the permutation classes to allow different representations, one of which could be via disjoint cycles. For (1), I would like to use the python with statement if possible. We could additionally support a function leftMul(perm1, perm2, ...). A thin wrapper LeftMul()_perm1_perm2 could also work, but getting out the permutation requires additional brackets as far as I can tell. (2) Is very easy to implement. (3) Could either follow the same ideas as (1), or (imho preferrably) just declare tuples to be cyles and lists to be "permutations in array form". (4) I don't know enough about. I hope this is of any help. Let me know if you would like me to code up some of this, I should have smallish amounts of free time starting from next week. |
(1) would be very painful, because it would have to change the order globally, meaning that all algorithms would essentially have to be written in an order independent way. |
btw, making mul work from R to L or L to R is easy to do. We just need to decide how P1*P2 should be interpreted: apply P1 then apply P2 or vice versa. I'm leaning towards making the multiplilcation go from R to L. |
@asmeurer Note that at least for groups, you can essentially switch between left and right multiplication by replacing every element by its inverse. (This isn't practical when entering, but allows an easy wrapper for algorithms, I think.) |
Ignore the previous question about A and B and contains. I moved the old |
@pernici , this should be ready for any modifications that you want to make. |
After the change in |
If strict is True, should that be G.order() != self.order(), hence
|
Shouldn't that be |
It seems to me that the definition of |
I made a pull request smichr#16; apart from adding a default argument to |
Added default argument `strict` to is_transitive`; fixed bug in `base`
I think I was confusing degree with order. I think the current implementation is fine. I fixed the doctest error in the patch and made another modification.
In order for this to happen we need better resizing. For this case, |
No, I wrote that before, but it is not true.
In this case the two |
I would like to eliminate the For instance
|
On Mon, Sep 17, 2012 at 11:44 AM, pernici notifications@github.com wrote:
|
In smichr#17
because |
I do not like the duplication of data between |
af=True will send them back in array form
OK, this is in. Thanks to all who helped in the review process. This ended up being a lot more involved that I imagined. |
Polyhedron and combinatorics; evalf(1); quick_sort; Basic.copy()
Awesome. Hopefully no issues slipped past Travis. It's time to release... |
Changes Unknown when pulling 419d310 on smichr:combinatorics into * on sympy:0.7.2*. |
Changes Unknown when pulling 419d310 on smichr:combinatorics into * on sympy:0.7.2*. |
Changes Unknown when pulling 419d310 on smichr:combinatorics into * on sympy:0.7.2*. |
this is the same as #1498 but committed against 0.7.2