-
-
Notifications
You must be signed in to change notification settings - Fork 557
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
unrank via R[i] conflicts with notation for constructing polynomial rings in CartesianProduct #15919
Comments
comment:2
I think the bug is in unrank, not in the fact that rings use
The function "unrank" should only be applied to indexable cartesian products, i.e., cartesian products of indexables. That's not the same as iterables. In particular, So the problem is really in
tries |
comment:3
Hmm. So Sets are not required to define getitem in a reasonable way? Good to know. |
comment:4
Nicolas Thiéry suggested deprecating |
comment:5
I agree too if we can do this quickly enough. This is causing problems in #10963... |
Branch: u/nthiery/ticket/15919 |
Commit: |
comment:7
The above branch takes a first step toward using more systematically the unrank protocol, in that case in I agree with Nils though: the sampling in the TestSuite should not be using [i] to do unranking, and probably should just assume that the object is iterable, and not necessarily unrankable. I'll have a look unless someone beats me to it. The third alternative, explored by Darij in his branch, is to reinstate temporarily the notation FF[i] for unranking for IntegerModRing and friends. What do you think? New commits:
|
Changed branch from u/nthiery/ticket/15919 to u/tscrim/ticket/15919 |
comment:9
Hey Nicolas, I've expanded upon what New commits:
|
comment:10
Not a review, just a tiny remark: the colon before the doctest in |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:12
Hi Travis! Thanks for the improvement! I made one further step, in particular to I am still unhappy about the Cheers, |
Changed branch from u/tscrim/ticket/15919 to u/nthiery/ticket/15919 |
comment:14
Replying to @tscrim:
+1. Let's focus here on what's needed for #10963. New commits:
|
comment:15
Ah shoot, the sampling issue actually occurs with #10963. At this point I am tempted to remove the sampling altogether in The code would then just be:
I am now running the tests with #10963 and this change. Cheers, |
comment:16
With just this change (and not the rest of the stuff in this branch), #10963 passes all tests. At this point, I am tempted to split this ticket into two tickets:
What do you think? |
comment:17
(Much) More of me says this change to I'd say the problem with Best, Travis |
Changed branch from u/nthiery/ticket/15919 to u/tscrim/ticket/15919 |
comment:19
Replying to @tscrim:
Ok, glad to see we are on the same line. I have created #16244 for
Ok, I am happy with your change. So I guess this can be positive reviewed. There remains to update the description of this ticket to better reflect what has actually been done, and refer to the other ticket for the actual solution of the original issue. |
This comment has been minimized.
This comment has been minimized.
comment:20
Done and done. |
Reviewer: Travis Scrimshaw |
Author: Nicolas M. Thiéry |
comment:22
Thanks Travis! |
comment:23
The only thing that somewhat worries me is the speed. Before:
After:
(These timings are fairly independent on the 20 and the 3...) I don't know how often this unranking is used, though, and whether these µs add up... |
comment:24
Replying to @darijgr:
Ah good point; the My impression is that this unranking is not used much. If it really Besides, things should eventually resolve by themselves as CartesianProduct gets So altogether, in this balance between overhead and correctness, I |
comment:25
I am not suggesting to go against correctness! My original idea on this ticket was to de-prioritize the notation |
comment:26
Replying to @darijgr:
Oops, sorry if my wording involuntarily implied this :-) I just meant Unless someone raises an objection now, this is good to go! Thanks to both of you. |
Changed branch from u/tscrim/ticket/15919 to |
This should give a list of 3-arrays of elements of Z/29. Instead I get:
And 29 is the smallest number where this seems to throw this error; also, it doesn't fail if I only take the cartesian product of two copies of the field.
I get a similar error if I do
CartesianProduct(FF, FF).unrank(3)
, and this has been around for a while (not just since beta4):So it seems that both bugs are due to the fancy
R[x]
syntax for polynomial rings conflicting with theR[i]
syntax for the i-th element of an enumerated setR
, and #8389 didn't cause the error, but at most exposed it better.This reworks the
unrank
function insage.combinat.ranker
and uses it for the Cartesian product (this doesn't work forZZ
, see #16239). In followup tickets, we also want to be more systematic about using unrank inTestSuite
and do better construction ofsome_elements()
#16244.CC: @mezzarobba @sagetrac-sage-combinat
Component: algebra
Keywords: notation, algebra, polynomial
Author: Nicolas M. Thiéry
Branch/Commit:
79d4698
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/15919
The text was updated successfully, but these errors were encountered: