class_docstr: IntegerComparator(value, geq, wires)
  Apply a controlled Pauli X gate using integer comparison as the condition.
  
  Given a basis state :math:`\vert n \rangle`, where :math:`n` is a positive integer, and a fixed positive
  integer :math:`L`, flip a target qubit if :math:`n \geq L`. Alternatively, the flipping condition can
  be :math:`n < L`.
  
  **Details:**
  
  * Number of wires: Any (the operation can act on any number of wires)
  * Number of parameters: 1
  * Gradient recipe: None
  
  .. note::
  
      This operation has one parameter: ``value``. However, ``value`` is simply an integer that is required to define
      the condition upon which a Pauli X gate is applied to the target wire. Given that, IntegerComparator has a
      gradient of zero; ``value`` is a non-differentiable parameter.
  
  Args:
      value (int): The value :math:`L` that the state's decimal representation is compared against.
      geq (bool): If set to ``True``, the comparison made will be :math:`n \geq L`. If ``False``, the comparison
          made will be :math:`n < L`.
      wires (Union[Wires, Sequence[int], or int]): Control wire(s) followed by a single target wire where
          the operation acts on.
  
  **Example**
  
  >>> dev = qml.device("default.qubit", wires=3)
  >>> @qml.qnode(dev)
  ... def circuit(state, value, geq):
  ...     qml.BasisState(np.array(state), wires=range(3))
  ...     qml.IntegerComparator(value, geq=geq, wires=range(3))
  ...     return qml.state()
  >>> circuit([1, 0, 1], 1, True).reshape(2, 2, 2)[1, 0, 0]
  tensor(1.+0.j, requires_grad=True)
  >>> circuit([0, 1, 0], 3, False).reshape(2, 2, 2)[0, 1, 1]
  tensor(1.+0.j, requires_grad=True)
class_docstr_tok: ["IntegerComparator","(","value",",","geq",",","wires",")","Apply","a","controlled","Pauli","X","gate","using","integer","comparison","as","the","condition",".","Given","a","basis","state",":","math",":","`","\\vert","n","\\rangle","`",",","where",":","math",":","`","n","`","is","a","positive","integer",",","and","a","fixed","positive","integer",":","math",":","`","L","`",",","flip","a","target","qubit","if",":","math",":","`","n","\\geq","L","`",".","Alternatively",",","the","flipping","condition","can","be",":","math",":","`","n","<","L","`",".","*","*","Details",":","*","*","*","Number","of","wires",":","Any","(","the","operation","can","act","on","any","number","of","wires",")","*","Number","of","parameters",":","1","*","Gradient","recipe",":","None","..","note",":",":","This","operation","has","one","parameter",":","``","value","``",".","However",",","``","value","``","is","simply","an","integer","that","is","required","to","define","the","condition","upon","which","a","Pauli","X","gate","is","applied","to","the","target","wire",".","Given","that",",","IntegerComparator","has","a","gradient","of","zero",";","``","value","``","is","a","non-differentiable","parameter",".","Args",":","value","(","int",")",":","The","value",":","math",":","`","L","`","that","the","state","'s","decimal","representation","is","compared","against",".","geq","(","bool",")",":","If","set","to","``","True","``",",","the","comparison","made","will","be",":","math",":","`","n","\\geq","L","`",".","If","``","False","``",",","the","comparison","made","will","be",":","math",":","`","n","<","L","`",".","wires","(","Union","[","Wires",",","Sequence","[","int","]",",","or","int","]",")",":","Control","wire","(","s",")","followed","by","a","single","target","wire","where","the","operation","acts","on",".","*","*","Example","*","*",">",">",">","dev","=","qml.device","(","``","default.qubit","''",",","wires=3",")",">",">",">","@","qml.qnode","(","dev",")","...","def","circuit","(","state",",","value",",","geq",")",":","...","qml.BasisState","(","np.array","(","state",")",",","wires=range","(","3",")",")","...","qml.IntegerComparator","(","value",",","geq=geq",",","wires=range","(","3",")",")","...","return","qml.state","(",")",">",">",">","circuit","(","[","1",",","0",",","1","]",",","1",",","True",")",".reshape","(","2",",","2",",","2",")","[","1",",","0",",","0","]","tensor","(","1.+0.j",",","requires_grad=True",")",">",">",">","circuit","(","[","0",",","1",",","0","]",",","3",",","False",")",".reshape","(","2",",","2",",","2",")","[","0",",","1",",","1","]","tensor","(","1.+0.j",",","requires_grad=True",")"]
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:`~.IntegerComparator.matrix`
  
  Args:
      value (int): The value :math:`L` that the state's decimal representation is compared against.
      control_wires (Union[Wires, Sequence[int], or int]): wires to place controls on
      geq (bool): If set to `True`, the comparison made will be :math:`n \geq L`. If `False`, the comparison
          made will be :math:`n < L`.
  
  Returns:
     tensor_like: matrix representation
  
  **Example**
  
  >>> print(qml.IntegerComparator.compute_matrix(2, [0, 1]))
  [[1. 0. 0. 0. 0. 0. 0. 0.]
   [0. 1. 0. 0. 0. 0. 0. 0.]
   [0. 0. 1. 0. 0. 0. 0. 0.]
   [0. 0. 0. 1. 0. 0. 0. 0.]
   [0. 0. 0. 0. 0. 1. 0. 0.]
   [0. 0. 0. 0. 1. 0. 0. 0.]
   [0. 0. 0. 0. 0. 0. 0. 1.]
   [0. 0. 0. 0. 0. 0. 1. 0.]]
  >>> print(qml.IntegerComparator.compute_matrix(2, [0, 1], geq=False))
  [[0. 1. 0. 0. 0. 0. 0. 0.]
   [1. 0. 0. 0. 0. 0. 0. 0.]
   [0. 0. 0. 1. 0. 0. 0. 0.]
   [0. 0. 1. 0. 0. 0. 0. 0.]
   [0. 0. 0. 0. 1. 0. 0. 0.]
   [0. 0. 0. 0. 0. 1. 0. 0.]
   [0. 0. 0. 0. 0. 0. 1. 0.]
   [0. 0. 0. 0. 0. 0. 0. 1.]]
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",":","`","~.IntegerComparator.matrix","`","Args",":","value","(","int",")",":","The","value",":","math",":","`","L","`","that","the","state","'s","decimal","representation","is","compared","against",".","control_wires","(","Union","[","Wires",",","Sequence","[","int","]",",","or","int","]",")",":","wires","to","place","controls","on","geq","(","bool",")",":","If","set","to","`","True","`",",","the","comparison","made","will","be",":","math",":","`","n","\\geq","L","`",".","If","`","False","`",",","the","comparison","made","will","be",":","math",":","`","n","<","L","`",".","Returns",":","tensor_like",":","matrix","representation","*","*","Example","*","*",">",">",">","print","(","qml.IntegerComparator.compute_matrix","(","2",",","[","0",",","1","]",")",")","[","[","1",".","0",".","0",".","0",".","0",".","0",".","0",".","0",".","]","[","0",".","1",".","0",".","0",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","1",".","0",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","1",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","1",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","1",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","0",".","1",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","1",".","0",".","]","]",">",">",">","print","(","qml.IntegerComparator.compute_matrix","(","2",",","[","0",",","1","]",",","geq=False",")",")","[","[","0",".","1",".","0",".","0",".","0",".","0",".","0",".","0",".","]","[","1",".","0",".","0",".","0",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","1",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","1",".","0",".","0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","1",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","1",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","1",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","0",".","1",".","]","]"]
code: def compute_matrix(
      value=None, control_wires=None, geq=True, **kwargs
  ):  # 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:`~.IntegerComparator.matrix`
  
      Args:
          value (int): The value :math:`L` that the state's decimal representation is compared against.
          control_wires (Union[Wires, Sequence[int], or int]): wires to place controls on
          geq (bool): If set to `True`, the comparison made will be :math:`n \geq L`. If `False`, the comparison
              made will be :math:`n < L`.
  
      Returns:
         tensor_like: matrix representation
  
      **Example**
  
      >>> print(qml.IntegerComparator.compute_matrix(2, [0, 1]))
      [[1. 0. 0. 0. 0. 0. 0. 0.]
       [0. 1. 0. 0. 0. 0. 0. 0.]
       [0. 0. 1. 0. 0. 0. 0. 0.]
       [0. 0. 0. 1. 0. 0. 0. 0.]
       [0. 0. 0. 0. 0. 1. 0. 0.]
       [0. 0. 0. 0. 1. 0. 0. 0.]
       [0. 0. 0. 0. 0. 0. 0. 1.]
       [0. 0. 0. 0. 0. 0. 1. 0.]]
      >>> print(qml.IntegerComparator.compute_matrix(2, [0, 1], geq=False))
      [[0. 1. 0. 0. 0. 0. 0. 0.]
       [1. 0. 0. 0. 0. 0. 0. 0.]
       [0. 0. 0. 1. 0. 0. 0. 0.]
       [0. 0. 1. 0. 0. 0. 0. 0.]
       [0. 0. 0. 0. 1. 0. 0. 0.]
       [0. 0. 0. 0. 0. 1. 0. 0.]
       [0. 0. 0. 0. 0. 0. 1. 0.]
       [0. 0. 0. 0. 0. 0. 0. 1.]]
      """
  
      if value is None:
          raise ValueError("The value to compare to must be specified.")
      if control_wires is None:
          raise ValueError("Must specify the control wires.")
      if not isinstance(value, int):
          raise ValueError(
              f"The compared value must be an int. Got {type(value)}."
          )
  
      small_val = not geq and value == 0
      large_val = geq and value > 2 ** len(control_wires) - 1
      if small_val or large_val:
          mat = np.eye(2 ** (len(control_wires) + 1))
  
      else:
          values = (
              range(value, 2 ** (len(control_wires)))
              if geq
              else range(value)
          )
          binary = "0" + str(len(control_wires)) + "b"
          control_values_list = [format(n, binary) for n in values]
          mat = np.eye(2 ** (len(control_wires) + 1))
          for control_values in control_values_list:
              mat = mat @ MultiControlledX.compute_matrix(
                  control_wires, control_values=control_values
              )
  
      return mat
  
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 4 for calling the IntegerComparator obj's underlying member method code with example usage: obj.compute_matrix(value, control_wires, geq) and returns: mat