class_docstr: Tests for the qft operations
docstr: Test if the QFT operation is correctly decomposed
docstr_tok: ["Test","if","the","QFT","operation","is","correctly","decomposed"]
code: def test_QFT_decomposition(self, n_qubits):
      """Test if the QFT operation is correctly decomposed"""
      op = qml.QFT(wires=range(n_qubits))
      decomp = op.decomposition()
  
      dev = qml.device("default.qubit", wires=n_qubits)
  
      out_states = []
      for state in np.eye(2**n_qubits):
          ops = [qml.StatePrep(state, wires=range(n_qubits))] + decomp
          qs = qml.tape.QuantumScript(ops, [qml.state()])
          out_states.append(dev.execute(qs))
  
      reconstructed_unitary = np.array(out_states).T
      expected_unitary = qml.QFT(wires=range(n_qubits)).matrix()
  
      assert np.allclose(reconstructed_unitary, expected_unitary)
  
file_path: pennylane/tests/templates/test_subroutines/test_qft.py
imports: import pytest
  import numpy
  from gate_data import QFT
  import pennylane
label_desc: Use image node_id 2 for calling the TestQFT obj's underlying member method code with example usage: obj.test_QFT_decomposition(n_qubits) without return types