code: def test_dmp_gcd():
      R, x, y = ring("x,y", ZZ)
  
      f, g = 0, 0
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (0, 0, 0)
      )
  
      f, g = 2, 0
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, 0)
      )
  
      f, g = -2, 0
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, -1, 0)
      )
  
      f, g = 0, -2
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 0, -1)
      )
  
      f, g = 0, 2 * x + 4
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (2 * x + 4, 0, 1)
      )
  
      f, g = 2 * x + 4, 0
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (2 * x + 4, 1, 0)
      )
  
      f, g = 2, 2
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, 1)
      )
  
      f, g = -2, 2
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, -1, 1)
      )
  
      f, g = 2, -2
      assert (
          R.dmp_zz_heu_gcd(f, g) == R.dmp_rr_prs_gcd(f, g) == (2, 1, -1)
      )
  
      f, g = -2, -2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (2, -1, -1)
      )
  
      f, g = x**2 + 2 * x + 1, 1
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (1, x**2 + 2 * x + 1, 1)
      )
  
      f, g = x**2 + 2 * x + 1, 2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (1, x**2 + 2 * x + 1, 2)
      )
  
      f, g = 2 * x**2 + 4 * x + 2, 2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (2, x**2 + 2 * x + 1, 1)
      )
  
      f, g = 2, 2 * x**2 + 4 * x + 2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (2, 1, x**2 + 2 * x + 1)
      )
  
      f, g = 2 * x**2 + 4 * x + 2, x + 1
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (x + 1, 2 * x + 2, 1)
      )
  
      f, g = x + 1, 2 * x**2 + 4 * x + 2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (x + 1, 1, 2 * x + 2)
      )
  
      R, x, y, z, u = ring("x,y,z,u", ZZ)
  
      f, g = u**2 + 2 * u + 1, 2 * u + 2
      assert (
          R.dmp_zz_heu_gcd(f, g)
          == R.dmp_rr_prs_gcd(f, g)
          == (u + 1, u + 1, 2)
      )
  
      f, g = (
          z**2 * u**2 + 2 * z**2 * u + z**2 + z * u + z,
          u**2 + 2 * u + 1,
      )
      h, cff, cfg = u + 1, z**2 * u + z**2 + z, u + 1
  
      assert R.dmp_zz_heu_gcd(f, g) == (h, cff, cfg)
      assert R.dmp_rr_prs_gcd(f, g) == (h, cff, cfg)
  
      assert R.dmp_zz_heu_gcd(g, f) == (h, cfg, cff)
      assert R.dmp_rr_prs_gcd(g, f) == (h, cfg, cff)
  
      R, x, y, z = ring("x,y,z", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(2, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      H, cff, cfg = R.dmp_rr_prs_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y, z, u, v = ring("x,y,z,u,v", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(4, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y, z, u, v, a, b = ring("x,y,z,u,v,a,b", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(6, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y, z, u, v, a, b, c, d = ring("x,y,z,u,v,a,b,c,d", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_1(8, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y, z = ring("x,y,z", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_2(2, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      H, cff, cfg = R.dmp_rr_prs_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_3(2, ZZ))
      H, cff, cfg = R.dmp_zz_heu_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      H, cff, cfg = R.dmp_rr_prs_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y, z, u, v = ring("x,y,z,u,v", ZZ)
  
      f, g, h = map(R.from_dense, dmp_fateman_poly_F_3(4, ZZ))
      H, cff, cfg = R.dmp_inner_gcd(f, g)
  
      assert (
          H == h and R.dmp_mul(H, cff) == f and R.dmp_mul(H, cfg) == g
      )
  
      R, x, y = ring("x,y", QQ)
  
      f = QQ(1, 2) * x**2 + x + QQ(1, 2)
      g = QQ(1, 2) * x + QQ(1, 2)
  
      h = x + 1
  
      assert R.dmp_qq_heu_gcd(f, g) == (h, g, QQ(1, 2))
      assert R.dmp_ff_prs_gcd(f, g) == (h, g, QQ(1, 2))
  
      R, x, y = ring("x,y", RR)
  
      f = 2.1 * x * y**2 - 2.2 * x * y + 2.1 * x
      g = 1.0 * x**3
  
      assert R.dmp_ff_prs_gcd(f, g) == (
          1.0 * x,
          2.1 * y**2 - 2.2 * y + 2.1,
          1.0 * x**2,
      )
  
file_path: sympy/sympy/polys/tests/test_euclidtools.py
imports: from sympy.polys.rings import ring
  from sympy.polys.domains import ZZ, QQ, RR
  from sympy.polys.specialpolys import f_polys, dmp_fateman_poly_F_1, dmp_fateman_poly_F_2, dmp_fateman_poly_F_3
label_desc: Use image node_id 10 for calling a global function with example usage: test_dmp_gcd() without return types