class_docstr: QFT(wires)
  Apply a quantum Fourier transform (QFT).
  
  For the :math:`N`-qubit computational basis state :math:`|m\rangle`, the QFT performs the
  transformation
  
  .. math::
  
      |m\rangle \rightarrow \frac{1}{\sqrt{2^{N}}}\sum_{n=0}^{2^{N} - 1}\omega_{N}^{mn} |n\rangle,
  
  where :math:`\omega_{N} = e^{\frac{2 \pi i}{2^{N}}}` is the :math:`2^{N}`-th root of unity.
  
  **Details:**
  
  * Number of wires: Any (the operation can act on any number of wires)
  * Number of parameters: 0
  * Gradient recipe: None
  
  Args:
      wires (int or Iterable[Number, str]]): the wire(s) the operation acts on
  
  **Example**
  
  The quantum Fourier transform is applied by specifying the corresponding wires:
  
  .. code-block::
  
      wires = 3
  
      dev = qml.device('default.qubit',wires=wires)
  
      @qml.qnode(dev)
      def circuit_qft(basis_state):
          qml.BasisState(basis_state, wires=range(wires))
          qml.QFT(wires=range(wires))
          return qml.state()
  
      circuit_qft(np.array([1.0, 0.0, 0.0], requires_grad=False))
docstr: Representation of the operator as a product of other operators (static method).
  
  .. math:: O = O_1 O_2 \dots O_n.
  
  
  .. seealso:: :meth:`~.QFT.decomposition`.
  
  Args:
      wires (Iterable, Wires): wires that the operator acts on
      n_wires (int): number of wires or ``len(wires)``
  
  Returns:
      list[Operator]: decomposition of the operator
  
  **Example:**
  
  >>> qml.QFT.compute_decomposition((0,1,2,4))
  [Toffoli(wires=[1, 2, 4]), CNOT(wires=[1, 2]), Toffoli(wires=[0, 2, 4])]
docstr_tok: ["Representation","of","the","operator","as","a","product","of","other","operators","(","static","method",")",".","..","math",":",":","O","=","O_1","O_2","\\dots","O_n",".","..","seealso",":",":",":","meth",":","`","~.QFT.decomposition","`",".","Args",":","wires","(","Iterable",",","Wires",")",":","wires","that","the","operator","acts","on","n_wires","(","int",")",":","number","of","wires","or","``","len","(","wires",")","``","Returns",":","list","[","Operator","]",":","decomposition","of","the","operator","*","*","Example",":","*","*",">",">",">","qml.QFT.compute_decomposition","(","(","0,1,2,4",")",")","[","Toffoli","(","wires=","[","1",",","2",",","4","]",")",",","CNOT","(","wires=","[","1",",","2","]",")",",","Toffoli","(","wires=","[","0",",","2",",","4","]",")","]"]
code: def compute_decomposition(
      wires, n_wires
  ):  # pylint: disable=arguments-differ,unused-argument
      r"""Representation of the operator as a product of other operators (static method).
  
      .. math:: O = O_1 O_2 \dots O_n.
  
  
      .. seealso:: :meth:`~.QFT.decomposition`.
  
      Args:
          wires (Iterable, Wires): wires that the operator acts on
          n_wires (int): number of wires or ``len(wires)``
  
      Returns:
          list[Operator]: decomposition of the operator
  
      **Example:**
  
      >>> qml.QFT.compute_decomposition((0,1,2,4))
      [Toffoli(wires=[1, 2, 4]), CNOT(wires=[1, 2]), Toffoli(wires=[0, 2, 4])]
  
      """
      shifts = [2 * np.pi * 2**-i for i in range(2, n_wires + 1)]
  
      decomp_ops = []
      for i, wire in enumerate(wires):
          decomp_ops.append(qml.Hadamard(wire))
  
          for shift, control_wire in zip(
              shifts[: len(shifts) - i], wires[i + 1 :]
          ):
              op = qml.ControlledPhaseShift(
                  shift, wires=[control_wire, wire]
              )
              decomp_ops.append(op)
  
      first_half_wires = wires[: n_wires // 2]
      last_half_wires = wires[-(n_wires // 2) :]
  
      for wire1, wire2 in zip(
          first_half_wires, reversed(last_half_wires)
      ):
          swap = qml.SWAP(wires=[wire1, wire2])
          decomp_ops.append(swap)
  
      return decomp_ops
  
file_path: pennylane/pennylane/templates/subroutines/qft.py
imports: import functools
  import numpy
  import pennylane
  from pennylane.operation import AnyWires, Operation
label_desc: Use image node_id 5 for calling the QFT obj's underlying member method code with example usage: obj.compute_decomposition(wires, n_wires) and returns: decomp_ops