def dup_qq_heu_gcd(f, g, K0):
 result = _dup_ff_trivial_gcd(f, g, K0)
 if (result is not None):
  return result
 K1 = K0.get_ring()
 (cf, f) = dup_clear_denoms(f, K0, K1)
 (cg, g) = dup_clear_denoms(g, K0, K1)
 f = dup_convert(f, K0, K1)
 g = dup_convert(g, K0, K1)
 (h, cff, cfg) = dup_zz_heu_gcd(f, g, K1)
 h = dup_convert(h, K1, K0)
 c = dup_LC(h, K0)
 h = dup_monic(h, K0)
 cff = dup_convert(cff, K1, K0)
 cfg = dup_convert(cfg, K1, K0)
 cff = dup_mul_ground(cff, K0.quo(c, cf), K0)
 cfg = dup_mul_ground(cfg, K0.quo(c, cg), K0)
 return (h, cff, cfg)

def dup_qq_heu_gcd ( f , g , K0 ) : result = _dup_ff_trivial_gcd ( f , g , K0 ) if ( result is not None ) : return result K1 = K0 . get_ring ( ) ( cf , f ) = dup_clear_denoms ( f , K0 , K1 ) ( cg , g ) = dup_clear_denoms ( g , K0 , K1 ) f = dup_convert ( f , K0 , K1 ) g = dup_convert ( g , K0 , K1 ) ( h , cff , cfg ) = dup_zz_heu_gcd ( f , g , K1 ) h = dup_convert ( h , K1 , K0 ) c = dup_LC ( h , K0 ) h = dup_monic ( h , K0 ) cff = dup_convert ( cff , K1 , K0 ) cfg = dup_convert ( cfg , K1 , K0 ) cff = dup_mul_ground ( cff , K0 . quo ( c , cf ) , K0 ) cfg = dup_mul_ground ( cfg , K0 . quo ( c , cg ) , K0 ) return ( h , cff , cfg )
heuristic polynomial gcd in q[x] .