code: def test_ddm_ilu_solve():
      # Basic example
      # A = [[QQ(1), QQ(2)], [QQ(3), QQ(4)]]
      U = [[QQ(1), QQ(2)], [QQ(0), QQ(-2)]]
      L = [[QQ(1), QQ(0)], [QQ(3), QQ(1)]]
      swaps = []
      b = DDM([[QQ(1)], [QQ(2)]], (2, 1), QQ)
      x = DDM([[QQ(0)], [QQ(0)]], (2, 1), QQ)
      xexp = DDM([[QQ(0)], [QQ(1, 2)]], (2, 1), QQ)
      ddm_ilu_solve(x, L, U, swaps, b)
      assert x == xexp
  
      # Example with swaps
      # A = [[QQ(0), QQ(2)], [QQ(3), QQ(4)]]
      U = [[QQ(3), QQ(4)], [QQ(0), QQ(2)]]
      L = [[QQ(1), QQ(0)], [QQ(0), QQ(1)]]
      swaps = [(0, 1)]
      b = DDM([[QQ(1)], [QQ(2)]], (2, 1), QQ)
      x = DDM([[QQ(0)], [QQ(0)]], (2, 1), QQ)
      xexp = DDM([[QQ(0)], [QQ(1, 2)]], (2, 1), QQ)
      ddm_ilu_solve(x, L, U, swaps, b)
      assert x == xexp
  
      # Overdetermined, consistent
      # A = DDM([[QQ(1), QQ(2)], [QQ(3), QQ(4)], [QQ(5), QQ(6)]], (3, 2), QQ)
      U = [[QQ(1), QQ(2)], [QQ(0), QQ(-2)], [QQ(0), QQ(0)]]
      L = [
          [QQ(1), QQ(0), QQ(0)],
          [QQ(3), QQ(1), QQ(0)],
          [QQ(5), QQ(2), QQ(1)],
      ]
      swaps = []
      b = DDM([[QQ(1)], [QQ(2)], [QQ(3)]], (3, 1), QQ)
      x = DDM([[QQ(0)], [QQ(0)]], (2, 1), QQ)
      xexp = DDM([[QQ(0)], [QQ(1, 2)]], (2, 1), QQ)
      ddm_ilu_solve(x, L, U, swaps, b)
      assert x == xexp
  
      # Overdetermined, inconsistent
      b = DDM([[QQ(1)], [QQ(2)], [QQ(4)]], (3, 1), QQ)
      raises(
          DMNonInvertibleMatrixError,
          lambda: ddm_ilu_solve(x, L, U, swaps, b),
      )
  
      # Square, noninvertible
      # A = DDM([[QQ(1), QQ(2)], [QQ(1), QQ(2)]], (2, 2), QQ)
      U = [[QQ(1), QQ(2)], [QQ(0), QQ(0)]]
      L = [[QQ(1), QQ(0)], [QQ(1), QQ(1)]]
      swaps = []
      b = DDM([[QQ(1)], [QQ(2)]], (2, 1), QQ)
      raises(
          DMNonInvertibleMatrixError,
          lambda: ddm_ilu_solve(x, L, U, swaps, b),
      )
  
      # Underdetermined
      # A = DDM([[QQ(1), QQ(2)]], (1, 2), QQ)
      U = [[QQ(1), QQ(2)]]
      L = [[QQ(1)]]
      swaps = []
      b = DDM([[QQ(3)]], (1, 1), QQ)
      raises(
          NotImplementedError, lambda: ddm_ilu_solve(x, L, U, swaps, b)
      )
  
      # Shape mismatch
      b3 = DDM([[QQ(1)], [QQ(2)], [QQ(3)]], (3, 1), QQ)
      raises(DMShapeError, lambda: ddm_ilu_solve(x, L, U, swaps, b3))
  
      # Empty shape mismatch
      U = [[QQ(1)]]
      L = [[QQ(1)]]
      swaps = []
      x = [[QQ(1)]]
      b = []
      raises(DMShapeError, lambda: ddm_ilu_solve(x, L, U, swaps, b))
  
      # Empty system
      U = []
      L = []
      swaps = []
      b = []
      x = []
      ddm_ilu_solve(x, L, U, swaps, b)
      assert x == []
  
file_path: sympy/sympy/polys/matrices/tests/test_dense.py
imports: from sympy.testing.pytest import raises
  from sympy.polys import ZZ, QQ
  from sympy.polys.matrices.ddm import DDM
  from sympy.polys.matrices.dense import ddm_transpose, ddm_iadd, ddm_isub, ddm_ineg, ddm_imatmul, ddm_imul, ddm_irref, ddm_idet, ddm_iinv, ddm_ilu, ddm_ilu_split, ddm_ilu_solve, ddm_berk
  from sympy.polys.matrices.exceptions import DMDomainError, DMNonInvertibleMatrixError, DMNonSquareMatrixError, DMShapeError
label_desc: Use image node_id 12 for calling a global function with example usage: test_ddm_ilu_solve() without return types