class_docstr: Tests for the ControlledQutritUnitary operation
class_docstr_tok: ["Tests","for","the","ControlledQutritUnitary","operation"]
docstr: Test that the matrix representation is defined correctly
docstr_tok: ["Test","that","the","matrix","representation","is","defined","correctly"]
code: def test_matrix_representation(self, tol):
      """Test that the matrix representation is defined correctly"""
      U = np.array(unitary_group.rvs(3, random_state=10))
      res_static = qml.ControlledQutritUnitary.compute_matrix(
          U, control_wires=[1], u_wires=[0]
      )
      res_dynamic = qml.ControlledQutritUnitary(
          U, control_wires=[1], wires=0
      ).matrix()
      expected = np.eye(9, dtype=np.complex128)
      expected[6:9, 6:9] = U
  
      assert np.allclose(res_static, expected, atol=tol)
      assert np.allclose(res_dynamic, expected, atol=tol)
  
imports: import pytest
  import numpy
  from scipy.stats import unitary_group
  from gate_data import TSWAP
  import pennylane
  from pennylane.wires import Wires
  from pennylane.operation import DecompositionUndefinedError
label_desc: Use image node_id 7 for calling the TestControlledQutritUnitary obj's underlying member method code with example usage: obj.test_matrix_representation(tol) without return types