-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
Inversion and fraction fields for power series rings #8972
Comments
Work Issues: segfault of div of Laurent series |
comment:1
OK, here is a patch. Idea:
With the patch, I get:
O dear. I just realise that there will be more work. There is a segmentation fault, as follows:
So, the division of elements of a Laurent series ring fails with a segmentation fault. By consequence, division of power series segfaults as well, with the patch. "Needs work", I presume. |
comment:2
Strangely, without the patch, the construction works:
The patch does this construction as well -- but segfaults. There seems to be a nasty side effect. |
comment:3
The segfault problem seems to come from the fact that the div method for Laurent series relies on the div method for power series -- and with my patch, the div method for power series uses the div method for Laurent series. Not good. But that seems solvable. |
Attachment: 8972_power_series_inverses.patch.gz Bugfixes for fraction field and inverses of power series over non-fields |
Changed work issues from segfault of div of Laurent series to none |
comment:4
OK, I replaced the old patch, and now it seems to work! For example:
The doc tests for the two modified files pass. So, ready for review! |
Author: Simon King |
comment:5
PS: Even the following works:
|
comment:6
I'm wary of such a big change until we have some timing tests in place. In particular, I'm worried about potential slowdowns in the Monsky-Washnitzer code. |
comment:7
Replying to @robertwb:
You are right, timing should be taken into account, and this is something my patch doesn't provide. Without the patch:
With the patch
So, it is slower by more than a factor five. |
Work Issues: improve timings |
comment:8
Concerning timings, I see a couple of things that might help improve the div method:
So, something to do for tomorrow. And I guess the ticket is again "needs work". |
comment:9
Replying to @simon-king-jena:
One more thing: The old code is quick if the result actually belongs to the power series ring, which is quite often the case; if this is not the case then often an error results. And I guess the parent should always be the fraction field, eventually. What I just tested (but I really should get some sleep now...) is to cache the fraction_field method, and to try to use the old code if the valuation of the denominator is not bigger than the valuation of the numerator; if this fails, then put numerator and denominator into the fraction field, and try again. Doing so brings the above timing to about 2ms, which is still a loss of factor two, but two is less than 5 or 6. I'll submit another patch after trying to lift the dependency of the two div methods on each other. |
Attachment: 8972_power_series_timing.patch.gz Improving the timings, to be applied after the bug fix patch |
Changed work issues from improve timings to none |
comment:10
The second patch does several things:
The reason why the old timings were good was some kind of lazyness: The result of a division was not in the fraction field (as it should be!), but in a simpler ring, so that subsequent computations became easier. On the other hand, transformation into a Laurent polynomial was quite expensive, since there always was a transformation into the Laurent Series Ring's underlying Power Series Ring -- even if the given data already belong to it. Solution (as usual): Add an optional argument "check" to the init method of Laurent Series. And then I tried to benefit from keeping the results as simple as possible (like the old code did), but in a more proper way. Let
Timings Without the two patches:
With the two patches:
So, my patches not only fix some bugs, but they also slightly improve the performance. I tested all files that I have changed, but I can not exclude errors in other files. I forgot to insert my name as an author, but presumably there will be a revision needed anyway, after comments of referees... |
comment:11
I forgot one remark: I don't know how this happens, but the
In other words, I don't know if this is acceptable, and also I don't understand how that happened. Shall I change it? |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:68
This should do. |
Changed author from Simon King to Simon King, Michael Jung |
comment:70
Replying to @mjungmath:
Does this also address the dependency #21283? |
Changed dependencies from #21283 to none |
comment:73
Replying to @pjbruin:
Nope. I just wanted to see what the patchbot has to say before I modify the ticket description. Here we go. |
This comment has been minimized.
This comment has been minimized.
comment:75
Yay! Patchbot is green! :) |
This comment has been minimized.
This comment has been minimized.
comment:78
Would be nice to have this ticket reviewed. Thanks. :) |
comment:81
Patchbot seems still be satisfied with beta7. It'd be nice to have this change in version 9.3 though. Otherwise, a rebase might become necessary soon... |
comment:82
There are a few details that still fixing: This seems strange:
Wouldn't it be better to be a specific reference to the class? Although I am not sure it is worth the direct reference. This is wrong:
Even for units, you still end up in the fraction field. -However, this must fail if the underlying ring is no integral domain::
+However, this must fail if the underlying ring is not an integral domain:: |
comment:83
Thank you Travis for taking a look! Replying to @tscrim:
Alright, I'll change it.
Oh right. I think the previous author already meant constant terms instead of leading terms. At least that would make more sense.
Will do. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:85
That should be better. |
comment:86
Thanks. LGTM. |
Changed reviewer from Robert Bradshaw to Robert Bradshaw, Travis Scrimshaw |
Changed branch from public/ticket/8972 to |
This ticket is about at least three bugs related with inversion of elements of power series rings.
Here is the first:
Both parents are wrong. Usually, the parent of
a/b
is the fraction field of the parent ofa,b
, even ifa==b
. And neither above parent is a field.Next bug:
And the third:
With the proposed patch, we solve all bugs except
Apply (old):
CC: @tscrim @mkoeppe @nbruin @jhpalmieri @dkrenn @bgrenet @sagetrac-tmonteil @videlec @DaveWitteMorris
Component: algebra
Keywords: power series ring, fraction field
Work Issues: doctest failures
Author: Simon King, Michael Jung
Branch/Commit:
5aca068
Reviewer: Robert Bradshaw, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/8972
The text was updated successfully, but these errors were encountered: