class_docstr: Tests for the ControlledQutritUnitary operation
class_docstr_tok: ["Tests","for","the","ControlledQutritUnitary","operation"]
docstr: Test that the matrix representation is defined correctly when broadcasting
docstr_tok: ["Test","that","the","matrix","representation","is","defined","correctly","when","broadcasting"]
code: def test_matrix_representation_broadcasted(self, tol):
      """Test that the matrix representation is defined correctly when broadcasting"""
      U1 = unitary_group.rvs(3, random_state=10)
      U2 = unitary_group.rvs(3, random_state=10)
      U3 = unitary_group.rvs(3, random_state=10)
      U = np.array([U1, U2, U3])
  
      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.array(
          [np.eye(9), np.eye(9), np.eye(9)], dtype=np.complex128
      )
      expected[0, 6:, 6:] = U1
      expected[1, 6:, 6:] = U2
      expected[2, 6:, 6:] = U3
      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 8 for calling the TestControlledQutritUnitary obj's underlying member method code with example usage: obj.test_matrix_representation_broadcasted(tol) without return types