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)
code: def __init__(self, n, wires, id=None):
      if not isinstance(wires, int) and len(wires) == 0:
          raise ValueError(
              "expected at least one wire representing the qubit "
          )
  
      if isinstance(wires, int):
          wires = 1 if wires == 0 else wires
          wires = list(range(wires))
  
      if isinstance(n, int):
          if n >= 0:
              n = self.to_list(n, len(wires))
          else:
              raise ValueError(
                  "expected an integer equal or greater than zero for basic flipping state"
              )
      n = tuple(n)
  
      if len(wires) != len(n):
          raise ValueError(
              "Wires length and flipping state length does not match, they must be equal length "
          )
  
      self._hyperparameters = {"arr_bin": n}
      super().__init__(wires=wires, id=id)
  
file_path: pennylane/pennylane/templates/subroutines/flip_sign.py
imports: import pennylane
  from pennylane.operation import Operation, AnyWires
label_desc: Use image node_id 3 to create a new FlipSign object from inherited base classes: Operation with example: obj = FlipSign(n, wires, id)