The solution is simply to add a function mpn_gcdext_min which
guarantees a "minimal" solution which is invariant across platforms.

It's more than a few percent to guarantee this in general, but the
Sage doctesting framework isn't particularly tolerant of changes in
output of functions.

Of course we need a mathematical definition of minimal. It's not a
good idea to try and guarantee that the output is the same once and
for all, unless that output is going to be meaningful. What is the
definition of minimal used in Sage currently?

Bill.

On Jan 13, 9:15 pm, ja...@njkfrudils.plus.com wrote:
> On Tuesday 13 January 2009 19:26:07 Carl Witty wrote:
>
>
>
> > On Jan 13, 2:38 am, ja...@njkfrudils.plus.com wrote:
> > > > > The other issue here is that there are multiple algorithms here and
> > > > > it is quite likely that very small examples will use the basic xgcd
> > > > > which may well guarantee minimality. Only if you have say hundreds of
> > > > > thousands of bits will the algorithm used not return minimally
> > > > > guaranteed results. I'm sure when the time comes we can give some
> > > > > explicit million digit integers for which minimality is not
> > > > > guaranteed.
>
> > > The non-minimal examples could be dependant on tuning parameters that
> > > select between different algorithms, making this sort testing impratical.
>
> > That's painful.
>
> > One of the great selling points for MPFR is that it always gives the
> > exact same answers on all platforms; it would be sad if MPIR doesn't
> > provide the same guarantees.
>
> > How much speed difference are we talking about?  IMHO, I would accept
> > a few percent slowdown for huge GCDs on some platforms to get
> > portable, identical results cross-platform in Sage.  (Of course, it's
> > not my decision to make.)
>
> > Carl
>
> If a function says it returns and anwser that satisfys certain conditions ,
> then that it what you should rely on. If your relying on unspecified behavour
> then it's on your own head :)
> Of course in common cases then the user expects certains properties to hold ,
> and if their not then confusion results.
>
> Consider this from the current gmp manual
>
>  -- Function: void mpz_gcdext (mpz_t G, mpz_t S, mpz_t T, mpz_t A,
>           mpz_t B)
>      Set G to the greatest common divisor of A and B, and in addition
>      set S and T to coefficients satisfying A*S + B*T = G.  G is always
>      positive, even if one or both of A and B are negative.
>      If T is `NULL' then that value is not computed.
>
> The function is free to return ANY solution (S,T) to the above , If your
> relying on certains bounds for S and T to be satisfied then you would have
> wrap this function in a layer to reduce the general case to the specific.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to