class_docstr: Test that two-qubit unitary operations are correctly decomposed.
class_docstr_tok: ["Test","that","two-qubit","unitary","operations","are","correctly","decomposed","."]
docstr: Test a matrix in U(4) is correct converted to SU(4).
docstr_tok: ["Test","a","matrix","in","U","(","4",")","is","correct","converted","to","SU","(","4",")","."]
code: def test_convert_to_su4(self, U):
      """Test a matrix in U(4) is correct converted to SU(4)."""
  
      U_su4 = _convert_to_su4(np.array(U))
  
      # Ensure the determinant is correct and the mats are equivalent up to a phase
      assert qml.math.isclose(qml.math.linalg.det(U_su4), 1.0)
      assert check_matrix_equivalence(np.array(U), U_su4)
  
imports: from functools import reduce
  import pytest
  from gate_data import I, Z, S, T, H, X, Y, CNOT, SWAP
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.ops.op_math.decompositions import one_qubit_decomposition
  from pennylane.ops.op_math.decompositions import two_qubit_decomposition
  from pennylane.ops.op_math.decompositions.two_qubit_unitary import _convert_to_su4, _su2su2_to_tensor_products, _compute_num_cnots
label_desc: Use image node_id 1 for calling the TestTwoQubitUnitaryDecomposition obj's underlying member method code with example usage: obj.test_convert_to_su4(U) without return types