class_docstr: Tests for the reduce_matrices function.
class_docstr_tok: ["Tests","for","the","reduce_matrices","function","."]
docstr: Test the reduce_matrices function with the dot method.
docstr_tok: ["Test","the","reduce_matrices","function","with","the","dot","method","."]
code: def test_prod_matrices(self):
      """Test the reduce_matrices function with the dot method."""
      mats_and_wires_gen = (
          (op.matrix(), op.wires) for op in self.op_list
      )
      reduced_mat, final_wires = qml.math.reduce_matrices(
          mats_and_wires_gen, qml.math.dot
      )
  
      expected_wires = reduce(
          lambda x, y: x + y, [op.wires for op in self.op_list]
      )
      expected_matrix = reduce(
          qml.math.dot,
          (op.matrix(wire_order=expected_wires) for op in self.op_list),
      )
  
      assert final_wires == expected_wires
      assert qml.math.allclose(reduced_mat, expected_matrix)
      assert reduced_mat.shape == (2**5, 2**5)
  
imports: from functools import reduce
  import numpy
  import pytest
  from gate_data import CNOT, II, SWAP, I, Toffoli
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestReduceMatrices obj's underlying member method code with example usage: obj.test_prod_matrices() without return types