[GiNaC-list] code: extended gcd

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Sun Oct 3 22:13:05 CEST 2004


Hi!

On Sun, 3 Oct 2004, Ralf Stephan wrote:
> please include the following snippet. Its application domain depends
> on that of quo() which is univariate, currently. It is tested but not
> heavily so. It is not optimized.
>
> Thanks,
> ralf
>
> Input: x,y rational polynomials
> Computes u,v,d such that ux+vy = gcd(x,y).
>
> /////////// Extended GCD
> ex xgcd (const ex& a, const ex& b, ex& u, ex& v, const symbol& s)

What's the point in having this twice?  In normal.cpp:1275 we have:

/** Compute GCD (Greatest Common Divisor) of multivariate polynomials a(X)
 *  and b(X) in Z[X].
 *
 *  @param a  first multivariate polynomial
 *  @param b  second multivariate polynomial
 *  @param ca pointer to expression that will receive the cofactor of a, or NULL
 *  @param cb pointer to expression that will receive the cofactor of b, or NULL
 *  @param check_args  check whether a and b are polynomials with rational
 *         coefficients (defaults to "true")
 *  @return the GCD as a new expression */
ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args)
{
    // ...

Is the root of the problem the missing documentation of cofactors in the
tutorial or am I missing something fundamental?!

Confused
     -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-list mailing list