Actually, the easiest solution for all is if we just switch over to the GMP gcd/gcdext code and ditch our own. Then it is guaranteed to be the same interface.
I think we can do this in less than a day's work. I don't think we'll loose anything dramatic by doing this. In fact I think their code might be slightly faster than ours at some points, though I haven't done a careful comparison to see what's different. Their code is definitely arranged better than ours. They have the Lehmer GCD factored out. I think I can live with using their code instead of using the code I spent days working on. Bill. On 9 April 2010 06:45, Bill Hart <goodwillh...@googlemail.com> wrote: > You could also try reverting the file mpn/generic/nhgcd2.c to the > version from MPIR 1.2.2. It's the only file in the xgcd/gcd code that > has been changed in MPIR. > > I don't guarantee this will cause all the doctests to pass, due to > differences in tuning cutoffs in MPIR. But if you just want the > doctests to pass, it might be the simplest solution. > > Bill. > > On 9 April 2010 06:17, William Stein <wst...@gmail.com> wrote: >> On Thu, Apr 8, 2010 at 10:01 PM, Bill Hart <goodwillh...@googlemail.com> >> wrote: >>> Here's what I think, though it's only an opinion: >>> >>> 0) It's surprising that this broke, as the new XGCD code went into >>> MPIR 1.2.0, which Sage already uses, but then it is not surprising as >>> any changes made to the XGCD code can currently change the >>> normalisation as no normalisation is enforced. >>> 1) It's unlikely we can fix this properly very quickly. I think we >>> have to hold this over until the next release of MPIR. >> >> When might that next release happen? Sage-5.0 is probably the next >> release of Sage, and that's at least a month away. >> >> William >> >>> 2) We could write a normalisation wrapper around mpn_gcdext, but it >>> would slow performance, so we obviously won't do that in a release. >>> >>> What could be done is to patch mpn_gcdext (see line 1105 of >>> mpn/generic/gcdext.c). >>> >>> Rename this function to _mpn_gcdext and write a new mpn_gcdext (in the >>> same file) which calls the old one and applies the required >>> normalisation (see the GMP 5 documentation for details of the >>> normalisation which Pari likes). >>> >>> The MPIR test suite will not care that you did this, as it doesn't >>> test normalisation. >>> >>> If doctests still fail in Sage, fixing them will make Sage compatible >>> both with future versions of MPIR, where we will fix this issue >>> properly, and with GMP 5 and above. This means that when GMP 5 becomes >>> stable and when the next version of MPIR comes out, Sage ought to, in >>> theory, be able to swap between the two without changing xgcd >>> normalisation. >>> >>> We purposely didn't deal with this issue because we thought Sage was >>> already set up to handle the "normalisation" that MPIR had and that if >>> we changed it, it would break. But it looks like I was wrong. >>> >>> Bill. >>> >>> On 9 April 2010 05:40, Bill Hart <goodwillh...@googlemail.com> wrote: >>>> That's great that it builds now. Well done, and thanks for the effort!! >>>> >>>> Our XGCD has changed, but I don't think we define a normalisation as >>>> such. From the manual: >>>> >>>> "Set g to the greatest common divisor of a and b, and in addition set >>>> s and t to coefficients >>>> satisfying as + bt = g. g is always positive, even if one or both of a >>>> and b are negative." >>>> >>>> GMP recently changed back to their old normalisation. >>>> >>>> It looks, from the test results below that we screw up Pari anyway, so >>>> we have to change something, it seems. Given that GMP changed back to >>>> the old normalisation to support Pari, we should probably do the same. >>>> I'm afraid this is not an issue we can resolve easily. The XGCD code >>>> is very complex and it will take quite some time to rewrite it to >>>> handle normalisation (which it currently just doesn't do at all). >>>> >>>> Bill. >>>> >>>> On 9 April 2010 05:10, William Stein <wst...@gmail.com> wrote: >>>>> Hi, >>>>> >>>>> OK, after all this, the build finally completed. The only changes I made >>>>> were: >>>>> >>>>> * Updated mpir to rc3 >>>>> * patched ecm as explained here: >>>>> >>>>> http://lists.gforge.inria.fr/pipermail/ecm-discuss/2009-August/004070.html >>>>> (Though this had to be slightly modified -- just search for the >>>>> same command, which moved.) >>>>> >>>>> >>>>> I then ran the long Sage test suite, and some tests fail. >>>>> >>>>> http://sage.math.washington.edu/home/wstein/build/mpir2/sage-4.3.5/testlong.log >>>>> >>>>> ---------------------------------------------------------------------- >>>>> The following tests failed: >>>>> >>>>> >>>>> sage -t -long "devel/sage/doc/en/tutorial/tour_numtheory.rst" >>>>> sage -t -long "devel/sage/doc/fr/tutorial/tour_numtheory.rst" >>>>> sage -t -long "devel/sage/sage/modular/cusps.py" >>>>> sage -t -long "devel/sage/sage/modular/modsym/boundary.py" >>>>> sage -t -long "devel/sage/sage/modular/modsym/ambient.py" >>>>> sage -t -long "devel/sage/sage/libs/pari/gen.pyx" >>>>> sage -t -long "devel/sage/sage/rings/arith.py" >>>>> sage -t -long "devel/sage/sage/rings/integer.pyx" >>>>> sage -t -long >>>>> "devel/sage/sage/rings/polynomial/multi_polynomial_ideal.py" >>>>> sage -t -long "devel/sage/sage/tests/book_stein_ent.py" >>>>> sage -t -long "devel/sage/sage/schemes/elliptic_curves/heegner.py" >>>>> Total time for all tests: 7170.6 seconds >>>>> >>>>> -- >>>>> >>>>> I looked and it appears that maybe all of these are the result of the >>>>> XGCD behavior in MPIR changing again. Has it changed to be like GMP >>>>> now? That would be convenient. >>>>> >>>>> This is all now >>>>> >>>>> http://trac.sagemath.org/sage_trac/ticket/8664 >>>>> >>>>> william >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google Groups >>>>> "mpir-devel" group. >>>>> To post to this group, send email to mpir-de...@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> mpir-devel+unsubscr...@googlegroups.com. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/mpir-devel?hl=en. >>>>> >>>>> >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "mpir-devel" group. >>> To post to this group, send email to mpir-de...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> mpir-devel+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/mpir-devel?hl=en. >>> >>> >> >> >> >> -- >> William Stein >> Associate Professor of Mathematics >> University of Washington >> http://wstein.org >> >> -- >> You received this message because you are subscribed to the Google Groups >> "mpir-devel" group. >> To post to this group, send email to mpir-de...@googlegroups.com. >> To unsubscribe from this group, send email to >> mpir-devel+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/mpir-devel?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To post to this group, send email to mpir-de...@googlegroups.com. To unsubscribe from this group, send email to mpir-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en.