class_docstr: Flips the sign of a given basis state.
  
  This template performs the following operation:
  
  FlipSign(n) :math:`|m\rangle = -|m\rangle` if :math:`m = n`
  
  FlipSign(n) :math:`|m\rangle = |m\rangle` if :math:`m \not = n`,
  
  where n is the basis state to flip and m is the input.
  
  Args:
      n (array[int] or int): binary array or integer value representing the state on which to
          flip the sign
      wires (array[int]): wires that the template acts on
  
  
  **Example**
  
  This template changes the sign of the basis state passed as an argument.
  In this example, when passing the element ``[1, 0]``, we will change the sign of the state :math:`|10\rangle`.
  We could alternatively pass the integer ``2`` and get the same result since its binary representation is ``[1, 0]``.
  
  .. code-block:: python
  
      basis_state = [1, 0]
  
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev)
      def circuit():
          for wire in list(range(2)):
              qml.Hadamard(wires=wire)
          qml.FlipSign(basis_state, wires=list(range(2)))
          return qml.state()
  
  The result for the above circuit is:
  
  .. code-block:: python
  
      >>> circuit()
      tensor([ 0.5+0.j,  0.5+0.j, -0.5+0.j,  0.5+0.j], requires_grad=True)
docstr: Representation of the operator
  
  .. seealso:: :meth:`~.FlipSign.decomposition`.
  
  Args:
      wires (array[int]): wires that the operator acts on
      arr_bin (array[int]): binary array vector representing the state to flip the sign
  
  Raises:
      ValueError: "Wires length and flipping state length does not match, they must be equal length "
  
  Returns:
      list[Operator]: decomposition of the operator
docstr_tok: ["Representation","of","the","operator","..","seealso",":",":",":","meth",":","`","~.FlipSign.decomposition","`",".","Args",":","wires","(","array","[","int","]",")",":","wires","that","the","operator","acts","on","arr_bin","(","array","[","int","]",")",":","binary","array","vector","representing","the","state","to","flip","the","sign","Raises",":","ValueError",":","``","Wires","length","and","flipping","state","length","does","not","match",",","they","must","be","equal","length","``","Returns",":","list","[","Operator","]",":","decomposition","of","the","operator"]
code: def compute_decomposition(
      wires, arr_bin
  ):  # pylint: disable=arguments-differ
      r"""Representation of the operator
  
      .. seealso:: :meth:`~.FlipSign.decomposition`.
  
      Args:
          wires (array[int]): wires that the operator acts on
          arr_bin (array[int]): binary array vector representing the state to flip the sign
  
      Raises:
          ValueError: "Wires length and flipping state length does not match, they must be equal length "
  
      Returns:
          list[Operator]: decomposition of the operator
      """
  
      op_list = []
  
      if arr_bin[-1] == 0:
          op_list.append(qml.PauliX(wires[-1]))
  
      op_list.append(
          qml.ctrl(
              qml.PauliZ(wires[-1]),
              control=wires[:-1],
              control_values=arr_bin[:-1],
          )
      )
  
      if arr_bin[-1] == 0:
          op_list.append(qml.PauliX(wires[-1]))
  
      return op_list
  
file_path: pennylane/pennylane/templates/subroutines/flip_sign.py
imports: import pennylane
  from pennylane.operation import Operation, AnyWires
label_desc: Use image node_id 6 for calling the FlipSign obj's underlying member method code with example usage: obj.compute_decomposition(wires, arr_bin) and returns: op_list