[Gmpcommit] /var/hg/gmp5.0: (mpn_gcdext): Copied doc updates from main repo.
mercurial at gmplib.org
mercurial at gmplib.org
Wed Feb 8 11:35:28 CET 2012
details: /var/hg/gmp5.0/rev/20931f25cbdc
changeset: 13554:20931f25cbdc
user: Niels M?ller <nisse at lysator.liu.se>
date: Wed Feb 08 11:35:25 2012 +0100
description:
(mpn_gcdext): Copied doc updates from main repo.
diffstat:
ChangeLog  1 +
doc/gmp.texi  29 +++++++++++++++++
2 files changed, 18 insertions(+), 12 deletions()
diffs (62 lines):
diff r ad7988649bd9 r 20931f25cbdc ChangeLog
 a/ChangeLog Wed Feb 08 09:43:10 2012 +0100
+++ b/ChangeLog Wed Feb 08 11:35:25 2012 +0100
@@ 1,6 +1,7 @@
20120208 Niels Möller <nisse at lysator.liu.se>
* doc/gmp.texi (mpz_gcdext): Describe cofactor canonicalization.
+ (mpn_gcdext): Copied doc updates from main repo.
20120207 Niels Möller <nisse at lysator.liu.se>
diff r ad7988649bd9 r 20931f25cbdc doc/gmp.texi
 a/doc/gmp.texi Wed Feb 08 09:43:10 2012 +0100
+++ b/doc/gmp.texi Wed Feb 08 11:35:25 2012 +0100
@@ 5403,30 +5403,35 @@
Both operands must be nonzero.
@end deftypefun
 at deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t *@var{yp}, mp_size_t @var{yn})
Let @m{U, at var{U}} be defined by @{@var{xp}, @var{xn}@} and let @m{V, at var{V}} be
defined by @{@var{yp}, @var{yn}@}.
+ at deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{up}, mp_size_t @var{un}, mp_limb_t *@var{vp}, mp_size_t @var{vn})
+Let @m{U, at var{U}} be defined by @{@var{up}, @var{un}@} and let @m{V, at var{V}} be
+defined by @{@var{vp}, @var{vn}@}.
Compute the greatest common divisor @math{G} of @math{U} and @math{V}. Compute
a cofactor @math{S} such that @math{G = US + VT}. The second cofactor @var{T}
is not computed but can easily be obtained from @m{(G  US) / V, (@var{G} 
@var{U}*@var{S}) / @var{V}} (the division will be exact). It is required that
 at math{U @ge V > 0}.
+ at math{@var{un} @ge @var{vn} > 0}, and the most significant
+limb of @{@var{vp}, @var{vn}@} must be nonzero.
@math{S} satisfies @math{S = 1} or @math{@GMPabs{S} < V / (2 G)}. @math{S =
0} if and only if @math{V} divides @math{U} (i.e., @math{G = V}).
Store @math{G} at @var{gp} and let the return value define its limb count.
Store @math{S} at @var{sp} and let *@var{sn} define its limb count. @math{S}
can be negative; when this happens *@var{sn} will be negative. The areas at
 at var{gp} and @var{sp} should each have room for @math{@var{xn}+1} limbs.

The areas @{@var{xp}, @math{@var{xn}+1}@} and @{@var{yp}, @math{@var{yn}+1}@}
are destroyed (i.e.@: the input operands plus an extra limb past the end of
each).

Compatibility note: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
+can be negative; when this happens *@var{sn} will be negative. The area at
+ at var{gp} should have room for @var{vn} limbs and the area at @var{sp} should
+have room for @math{@var{vn}+1} limbs.
+
+Both source operands are destroyed.
+
+Compatibility notes: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
Earlier as well as later GMP releases define @math{S} as described here.
+GMP releases before GMP 4.3.0 required additional space for both input and output
+areas. More precisely, the areas @{@var{up}, @math{@var{un}+1}@} and
+@{@var{vp}, @math{@var{vn}+1}@} were destroyed (i.e.@: the operands plus an
+extra limb past the end of each), and the areas pointed to by @var{gp} and
+ at var{sp} should each have room for @math{@var{un}+1} limbs.
@end deftypefun
@deftypefun mp_size_t mpn_sqrtrem (mp_limb_t *@var{r1p}, mp_limb_t *@var{r2p}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
More information about the gmpcommit
mailing list