class_docstr: QubitCarry(wires)
  Apply the ``QubitCarry`` operation to four input wires.
  
  This operation performs the transformation:
  
  .. math::
      |a\rangle |b\rangle |c\rangle |d\rangle \rightarrow |a\rangle |b\rangle |b\oplus c\rangle |bc \oplus d\oplus (b\oplus c)a\rangle
  
  .. figure:: ../../_static/ops/QubitCarry.svg
      :align: center
      :width: 60%
      :target: javascript:void(0);
  
  See `here <https://arxiv.org/abs/quant-ph/0008033v1>`__ for more information.
  
  .. note::
      The first wire should be used to input a carry bit from previous operations. The final wire
      holds the carry bit of this operation and the input state on this wire should be
      :math:`|0\rangle`.
  
  **Details:**
  
  * Number of wires: 4
  * Number of parameters: 0
  
  Args:
      wires (Sequence[int]): the wires the operation acts on
  
  **Example**
  
  The ``QubitCarry`` operation maps the state :math:`|0110\rangle` to :math:`|0101\rangle`, where
  the last qubit denotes the carry value:
  
  .. code-block::
  
      input_bitstring = (0, 1, 1, 0)
  
      @qml.qnode(dev)
      def circuit(basis_state):
          qml.BasisState(basis_state, wires=[0, 1, 2, 3])
          qml.QubitCarry(wires=[0, 1, 2, 3])
          return qml.probs(wires=[0, 1, 2, 3])
  
      probs =  circuit(input_bitstring)
      probs_indx = np.argwhere(probs == 1).flatten()[0]
      bitstrings = list(itertools.product(range(2), repeat=4))
      output_bitstring = bitstrings[probs_indx]
  
  The output bitstring is
  
  >>> output_bitstring
  (0, 1, 0, 1)
  
  The action of ``QubitCarry`` is to add wires ``1`` and ``2``. The modulo-two result is output
  in wire ``2`` with a carry value output in wire ``3``. In this case, :math:`1 \oplus 1 = 0` with
  a carry, so we have:
  
  >>> bc_sum = output_bitstring[2]
  >>> bc_sum
  0
  >>> carry = output_bitstring[3]
  >>> carry
  1
class_docstr_tok: ["QubitCarry","(","wires",")","Apply","the","``","QubitCarry","``","operation","to","four","input","wires",".","This","operation","performs","the","transformation",":","..","math",":",":","|a\\rangle","|b\\rangle","|c\\rangle","|d\\rangle","\\rightarrow","|a\\rangle","|b\\rangle","|b\\oplus","c\\rangle","|bc","\\oplus","d\\oplus","(","b\\oplus","c",")","a\\rangle","..","figure",":",":","..","\/","..","\/_static\/ops\/QubitCarry.svg",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";","See","`","here","<","https",":","\/\/arxiv.org\/abs\/quant-ph\/0008033v1",">","`","__","for","more","information",".","..","note",":",":","The","first","wire","should","be","used","to","input","a","carry","bit","from","previous","operations",".","The","final","wire","holds","the","carry","bit","of","this","operation","and","the","input","state","on","this","wire","should","be",":","math",":","`","|0\\rangle","`",".","*","*","Details",":","*","*","*","Number","of","wires",":","4","*","Number","of","parameters",":","0","Args",":","wires","(","Sequence","[","int","]",")",":","the","wires","the","operation","acts","on","*","*","Example","*","*","The","``","QubitCarry","``","operation","maps","the","state",":","math",":","`","|0110\\rangle","`","to",":","math",":","`","|0101\\rangle","`",",","where","the","last","qubit","denotes","the","carry","value",":","..","code-block",":",":","input_bitstring","=","(","0",",","1",",","1",",","0",")","@","qml.qnode","(","dev",")","def","circuit","(","basis_state",")",":","qml.BasisState","(","basis_state",",","wires=","[","0",",","1",",","2",",","3","]",")","qml.QubitCarry","(","wires=","[","0",",","1",",","2",",","3","]",")","return","qml.probs","(","wires=","[","0",",","1",",","2",",","3","]",")","probs","=","circuit","(","input_bitstring",")","probs_indx","=","np.argwhere","(","probs","==","1",")",".flatten","(",")","[","0","]","bitstrings","=","list","(","itertools.product","(","range","(","2",")",",","repeat=4",")",")","output_bitstring","=","bitstrings","[","probs_indx","]","The","output","bitstring","is",">",">",">","output_bitstring","(","0",",","1",",","0",",","1",")","The","action","of","``","QubitCarry","``","is","to","add","wires","``","1","``","and","``","2","``",".","The","modulo-two","result","is","output","in","wire","``","2","``","with","a","carry","value","output","in","wire","``","3","``",".","In","this","case",",",":","math",":","`","1","\\oplus","1","=","0","`","with","a","carry",",","so","we","have",":",">",">",">","bc_sum","=","output_bitstring","[","2","]",">",">",">","bc_sum","0",">",">",">","carry","=","output_bitstring","[","3","]",">",">",">","carry","1"]
docstr: Representation of the operator as a canonical matrix in the computational basis (static method).
  
  The canonical matrix is the textbook matrix representation that does not consider wires.
  Implicitly, this assumes that the wires of the operator correspond to the global wire order.
  
  .. seealso:: :meth:`~.QubitCarry.matrix`
  
  Returns:
      ndarray: matrix
  
  **Example**
  
  >>> print(qml.QubitCarry.compute_matrix())
  [[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
   [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
   [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]
   [0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
   [0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]
   [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]
   [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0]
   [0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]
   [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]
   [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0]
   [0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
   [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0]
   [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]
   [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0]
   [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]
   [0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]]
docstr_tok: ["Representation","of","the","operator","as","a","canonical","matrix","in","the","computational","basis","(","static","method",")",".","The","canonical","matrix","is","the","textbook","matrix","representation","that","does","not","consider","wires",".","Implicitly",",","this","assumes","that","the","wires","of","the","operator","correspond","to","the","global","wire","order",".","..","seealso",":",":",":","meth",":","`","~.QubitCarry.matrix","`","Returns",":","ndarray",":","matrix","*","*","Example","*","*",">",">",">","print","(","qml.QubitCarry.compute_matrix","(",")",")","[","[","1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","]","[","0","1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","]","[","0","0","1","0","0","0","0","0","0","0","0","0","0","0","0","0","]","[","0","0","0","1","0","0","0","0","0","0","0","0","0","0","0","0","]","[","0","0","0","0","0","0","0","1","0","0","0","0","0","0","0","0","]","[","0","0","0","0","0","0","1","0","0","0","0","0","0","0","0","0","]","[","0","0","0","0","1","0","0","0","0","0","0","0","0","0","0","0","]","[","0","0","0","0","0","1","0","0","0","0","0","0","0","0","0","0","]","[","0","0","0","0","0","0","0","0","1","0","0","0","0","0","0","0","]","[","0","0","0","0","0","0","0","0","0","1","0","0","0","0","0","0","]","[","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","0","]","[","0","0","0","0","0","0","0","0","0","0","1","0","0","0","0","0","]","[","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","1","]","[","0","0","0","0","0","0","0","0","0","0","0","0","0","0","1","0","]","[","0","0","0","0","0","0","0","0","0","0","0","0","0","1","0","0","]","[","0","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","]","]"]
code: def compute_matrix():  # pylint: disable=arguments-differ
      r"""Representation of the operator as a canonical matrix in the computational basis (static method).
  
      The canonical matrix is the textbook matrix representation that does not consider wires.
      Implicitly, this assumes that the wires of the operator correspond to the global wire order.
  
      .. seealso:: :meth:`~.QubitCarry.matrix`
  
      Returns:
          ndarray: matrix
  
      **Example**
  
      >>> print(qml.QubitCarry.compute_matrix())
      [[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
       [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
       [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]
       [0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
       [0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]
       [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]
       [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0]
       [0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]
       [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]
       [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0]
       [0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
       [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0]
       [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]
       [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0]
       [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]
       [0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]]
      """
      return np.array(
          [
              [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
          ]
      )
  
imports: from copy import copy
  import numpy
  import pennylane
  from pennylane.operation import AnyWires, Operation
  from pennylane.wires import Wires
  from pennylane.ops import Identity
  from pennylane.ops.qubit.non_parametric_ops import MultiControlledX
label_desc: Use image node_id 1 for calling the QubitCarry obj's underlying member method code with example usage: obj.compute_matrix() and returns: np