{"payload":{"allShortcutsEnabled":false,"fileTree":{"qiskit/circuit/library":{"items":[{"name":"arithmetic","path":"qiskit/circuit/library/arithmetic","contentType":"directory"},{"name":"basis_change","path":"qiskit/circuit/library/basis_change","contentType":"directory"},{"name":"boolean_logic","path":"qiskit/circuit/library/boolean_logic","contentType":"directory"},{"name":"data_preparation","path":"qiskit/circuit/library/data_preparation","contentType":"directory"},{"name":"generalized_gates","path":"qiskit/circuit/library/generalized_gates","contentType":"directory"},{"name":"n_local","path":"qiskit/circuit/library/n_local","contentType":"directory"},{"name":"standard_gates","path":"qiskit/circuit/library/standard_gates","contentType":"directory"},{"name":"templates","path":"qiskit/circuit/library/templates","contentType":"directory"},{"name":"__init__.py","path":"qiskit/circuit/library/__init__.py","contentType":"file"},{"name":"blueprintcircuit.py","path":"qiskit/circuit/library/blueprintcircuit.py","contentType":"file"},{"name":"fourier_checking.py","path":"qiskit/circuit/library/fourier_checking.py","contentType":"file"},{"name":"graph_state.py","path":"qiskit/circuit/library/graph_state.py","contentType":"file"},{"name":"grover_operator.py","path":"qiskit/circuit/library/grover_operator.py","contentType":"file"},{"name":"hamiltonian_gate.py","path":"qiskit/circuit/library/hamiltonian_gate.py","contentType":"file"},{"name":"hidden_linear_function.py","path":"qiskit/circuit/library/hidden_linear_function.py","contentType":"file"},{"name":"iqp.py","path":"qiskit/circuit/library/iqp.py","contentType":"file"},{"name":"overlap.py","path":"qiskit/circuit/library/overlap.py","contentType":"file"},{"name":"pauli_evolution.py","path":"qiskit/circuit/library/pauli_evolution.py","contentType":"file"},{"name":"phase_estimation.py","path":"qiskit/circuit/library/phase_estimation.py","contentType":"file"},{"name":"phase_oracle.py","path":"qiskit/circuit/library/phase_oracle.py","contentType":"file"},{"name":"quantum_volume.py","path":"qiskit/circuit/library/quantum_volume.py","contentType":"file"}],"totalCount":21},"qiskit/circuit":{"items":[{"name":"classical","path":"qiskit/circuit/classical","contentType":"directory"},{"name":"classicalfunction","path":"qiskit/circuit/classicalfunction","contentType":"directory"},{"name":"controlflow","path":"qiskit/circuit/controlflow","contentType":"directory"},{"name":"library","path":"qiskit/circuit/library","contentType":"directory"},{"name":"random","path":"qiskit/circuit/random","contentType":"directory"},{"name":"tools","path":"qiskit/circuit/tools","contentType":"directory"},{"name":"__init__.py","path":"qiskit/circuit/__init__.py","contentType":"file"},{"name":"_classical_resource_map.py","path":"qiskit/circuit/_classical_resource_map.py","contentType":"file"},{"name":"_standard_gates_commutations.py","path":"qiskit/circuit/_standard_gates_commutations.py","contentType":"file"},{"name":"_utils.py","path":"qiskit/circuit/_utils.py","contentType":"file"},{"name":"add_control.py","path":"qiskit/circuit/add_control.py","contentType":"file"},{"name":"annotated_operation.py","path":"qiskit/circuit/annotated_operation.py","contentType":"file"},{"name":"barrier.py","path":"qiskit/circuit/barrier.py","contentType":"file"},{"name":"bit.py","path":"qiskit/circuit/bit.py","contentType":"file"},{"name":"classicalregister.py","path":"qiskit/circuit/classicalregister.py","contentType":"file"},{"name":"commutation_checker.py","path":"qiskit/circuit/commutation_checker.py","contentType":"file"},{"name":"commutation_library.py","path":"qiskit/circuit/commutation_library.py","contentType":"file"},{"name":"controlledgate.py","path":"qiskit/circuit/controlledgate.py","contentType":"file"},{"name":"delay.py","path":"qiskit/circuit/delay.py","contentType":"file"},{"name":"duration.py","path":"qiskit/circuit/duration.py","contentType":"file"},{"name":"equivalence.py","path":"qiskit/circuit/equivalence.py","contentType":"file"},{"name":"equivalence_library.py","path":"qiskit/circuit/equivalence_library.py","contentType":"file"},{"name":"exceptions.py","path":"qiskit/circuit/exceptions.py","contentType":"file"},{"name":"gate.py","path":"qiskit/circuit/gate.py","contentType":"file"},{"name":"instruction.py","path":"qiskit/circuit/instruction.py","contentType":"file"},{"name":"instructionset.py","path":"qiskit/circuit/instructionset.py","contentType":"file"},{"name":"measure.py","path":"qiskit/circuit/measure.py","contentType":"file"},{"name":"operation.py","path":"qiskit/circuit/operation.py","contentType":"file"},{"name":"parameter.py","path":"qiskit/circuit/parameter.py","contentType":"file"},{"name":"parameterexpression.py","path":"qiskit/circuit/parameterexpression.py","contentType":"file"},{"name":"parametertable.py","path":"qiskit/circuit/parametertable.py","contentType":"file"},{"name":"parametervector.py","path":"qiskit/circuit/parametervector.py","contentType":"file"},{"name":"quantumcircuit.py","path":"qiskit/circuit/quantumcircuit.py","contentType":"file"},{"name":"quantumcircuitdata.py","path":"qiskit/circuit/quantumcircuitdata.py","contentType":"file"},{"name":"quantumregister.py","path":"qiskit/circuit/quantumregister.py","contentType":"file"},{"name":"register.py","path":"qiskit/circuit/register.py","contentType":"file"},{"name":"reset.py","path":"qiskit/circuit/reset.py","contentType":"file"},{"name":"singleton.py","path":"qiskit/circuit/singleton.py","contentType":"file"},{"name":"store.py","path":"qiskit/circuit/store.py","contentType":"file"}],"totalCount":39},"qiskit":{"items":[{"name":"assembler","path":"qiskit/assembler","contentType":"directory"},{"name":"circuit","path":"qiskit/circuit","contentType":"directory"},{"name":"compiler","path":"qiskit/compiler","contentType":"directory"},{"name":"converters","path":"qiskit/converters","contentType":"directory"},{"name":"dagcircuit","path":"qiskit/dagcircuit","contentType":"directory"},{"name":"passmanager","path":"qiskit/passmanager","contentType":"directory"},{"name":"primitives","path":"qiskit/primitives","contentType":"directory"},{"name":"providers","path":"qiskit/providers","contentType":"directory"},{"name":"pulse","path":"qiskit/pulse","contentType":"directory"},{"name":"qasm","path":"qiskit/qasm","contentType":"directory"},{"name":"qasm2","path":"qiskit/qasm2","contentType":"directory"},{"name":"qasm3","path":"qiskit/qasm3","contentType":"directory"},{"name":"qobj","path":"qiskit/qobj","contentType":"directory"},{"name":"qpy","path":"qiskit/qpy","contentType":"directory"},{"name":"quantum_info","path":"qiskit/quantum_info","contentType":"directory"},{"name":"result","path":"qiskit/result","contentType":"directory"},{"name":"scheduler","path":"qiskit/scheduler","contentType":"directory"},{"name":"synthesis","path":"qiskit/synthesis","contentType":"directory"},{"name":"transpiler","path":"qiskit/transpiler","contentType":"directory"},{"name":"utils","path":"qiskit/utils","contentType":"directory"},{"name":"visualization","path":"qiskit/visualization","contentType":"directory"},{"name":"VERSION.txt","path":"qiskit/VERSION.txt","contentType":"file"},{"name":"__init__.py","path":"qiskit/__init__.py","contentType":"file"},{"name":"exceptions.py","path":"qiskit/exceptions.py","contentType":"file"},{"name":"user_config.py","path":"qiskit/user_config.py","contentType":"file"},{"name":"version.py","path":"qiskit/version.py","contentType":"file"}],"totalCount":26},"":{"items":[{"name":".azure","path":".azure","contentType":"directory"},{"name":".binder","path":".binder","contentType":"directory"},{"name":".cargo","path":".cargo","contentType":"directory"},{"name":".github","path":".github","contentType":"directory"},{"name":"crates","path":"crates","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"qiskit","path":"qiskit","contentType":"directory"},{"name":"releasenotes","path":"releasenotes","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"tools","path":"tools","contentType":"directory"},{"name":".editorconfig","path":".editorconfig","contentType":"file"},{"name":".git-blame-ignore-revs","path":".git-blame-ignore-revs","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".local-spellings","path":".local-spellings","contentType":"file"},{"name":".mailmap","path":".mailmap","contentType":"file"},{"name":".mergify.yml","path":".mergify.yml","contentType":"file"},{"name":".stestr.conf","path":".stestr.conf","contentType":"file"},{"name":"CITATION.bib","path":"CITATION.bib","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"Cargo.lock","path":"Cargo.lock","contentType":"file"},{"name":"Cargo.toml","path":"Cargo.toml","contentType":"file"},{"name":"DEPRECATION.md","path":"DEPRECATION.md","contentType":"file"},{"name":"LICENSE.txt","path":"LICENSE.txt","contentType":"file"},{"name":"MAINTAINING.md","path":"MAINTAINING.md","contentType":"file"},{"name":"MANIFEST.in","path":"MANIFEST.in","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SECURITY.md","path":"SECURITY.md","contentType":"file"},{"name":"asv.conf.json","path":"asv.conf.json","contentType":"file"},{"name":"azure-pipelines.yml","path":"azure-pipelines.yml","contentType":"file"},{"name":"constraints.txt","path":"constraints.txt","contentType":"file"},{"name":"pyproject.toml","path":"pyproject.toml","contentType":"file"},{"name":"qiskit_bot.yaml","path":"qiskit_bot.yaml","contentType":"file"},{"name":"requirements-dev.txt","path":"requirements-dev.txt","contentType":"file"},{"name":"requirements-optional.txt","path":"requirements-optional.txt","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"},{"name":"rust-toolchain.toml","path":"rust-toolchain.toml","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"},{"name":"tox.ini","path":"tox.ini","contentType":"file"}],"totalCount":41}},"fileTreeProcessingTime":26.642794000000002,"foldersToFetch":[],"repo":{"id":83821669,"defaultBranch":"main","name":"qiskit","ownerLogin":"Qiskit","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2017-03-03T17:02:42.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/30696987?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1710785011.0","canEdit":false,"refType":"branch","currentOid":"43381ae1b159c01b55159d2dc1e8a65970b72746"},"path":"qiskit/circuit/library/grover_operator.py","currentUser":null,"blob":{"rawLines":["# This code is part of Qiskit.","#","# (C) Copyright IBM 2017, 2020.","#","# This code is licensed under the Apache License, Version 2.0. You may","# obtain a copy of this license in the LICENSE.txt file in the root directory","# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.","#","# Any modifications or derivative works of this code must retain this","# copyright notice, and modified files need to carry a notice indicating","# that they have been altered from the originals.","","\"\"\"The Grover operator.\"\"\"","","from __future__ import annotations","from typing import List, Optional, Union","import numpy","","from qiskit.circuit import QuantumCircuit, QuantumRegister, AncillaRegister","from qiskit.exceptions import QiskitError","from qiskit.quantum_info import Statevector, Operator, DensityMatrix","from .standard_gates import MCXGate","","","class GroverOperator(QuantumCircuit):"," r\"\"\"The Grover operator.",""," Grover's search algorithm [1, 2] consists of repeated applications of the so-called"," Grover operator used to amplify the amplitudes of the desired output states."," This operator, :math:`\\mathcal{Q}`, consists of the phase oracle, :math:`\\mathcal{S}_f`,"," zero phase-shift or zero reflection, :math:`\\mathcal{S}_0`, and an"," input state preparation :math:`\\mathcal{A}`:",""," .. math::"," \\mathcal{Q} = \\mathcal{A} \\mathcal{S}_0 \\mathcal{A}^\\dagger \\mathcal{S}_f",""," In the standard Grover search we have :math:`\\mathcal{A} = H^{\\otimes n}`:",""," .. math::"," \\mathcal{Q} = H^{\\otimes n} \\mathcal{S}_0 H^{\\otimes n} \\mathcal{S}_f"," = D \\mathcal{S_f}",""," The operation :math:`D = H^{\\otimes n} \\mathcal{S}_0 H^{\\otimes n}` is also referred to as"," diffusion operator. In this formulation we can see that Grover's operator consists of two"," steps: first, the phase oracle multiplies the good states by -1 (with :math:`\\mathcal{S}_f`)"," and then the whole state is reflected around the mean (with :math:`D`).",""," This class allows setting a different state preparation, as in quantum amplitude"," amplification (a generalization of Grover's algorithm), :math:`\\mathcal{A}` might not be"," a layer of Hardamard gates [3].",""," The action of the phase oracle :math:`\\mathcal{S}_f` is defined as",""," .. math::"," \\mathcal{S}_f: |x\\rangle \\mapsto (-1)^{f(x)}|x\\rangle",""," where :math:`f(x) = 1` if :math:`x` is a good state and 0 otherwise. To highlight the fact"," that this oracle flips the phase of the good states and does not flip the state of a result"," qubit, we call :math:`\\mathcal{S}_f` a phase oracle.",""," Note that you can easily construct a phase oracle from a bitflip oracle by sandwiching the"," controlled X gate on the result qubit by a X and H gate. For instance",""," .. parsed-literal::",""," Bitflip oracle Phaseflip oracle"," q_0: ──■── q_0: ────────────■────────────"," ┌─┴─┐ ┌───┐┌───┐┌─┴─┐┌───┐┌───┐"," out: ┤ X ├ out: ┤ X ├┤ H ├┤ X ├┤ H ├┤ X ├"," └───┘ └───┘└───┘└───┘└───┘└───┘",""," There is some flexibility in defining the oracle and :math:`\\mathcal{A}` operator. Before the"," Grover operator is applied in Grover's algorithm, the qubits are first prepared with one"," application of the :math:`\\mathcal{A}` operator (or Hadamard gates in the standard formulation)."," Thus, we always have operation of the form"," :math:`\\mathcal{A} \\mathcal{S}_f \\mathcal{A}^\\dagger`. Therefore it is possible to move"," bitflip logic into :math:`\\mathcal{A}` and leaving the oracle only to do phaseflips via Z gates"," based on the bitflips. One possible use-case for this are oracles that do not uncompute the"," state qubits.",""," The zero reflection :math:`\\mathcal{S}_0` is usually defined as",""," .. math::"," \\mathcal{S}_0 = 2 |0\\rangle^{\\otimes n} \\langle 0|^{\\otimes n} - \\mathbb{I}_n",""," where :math:`\\mathbb{I}_n` is the identity on :math:`n` qubits."," By default, this class implements the negative version"," :math:`2 |0\\rangle^{\\otimes n} \\langle 0|^{\\otimes n} - \\mathbb{I}_n`, since this can simply"," be implemented with a multi-controlled Z sandwiched by X gates on the target qubit and the"," introduced global phase does not matter for Grover's algorithm.",""," Examples:"," >>> from qiskit.circuit import QuantumCircuit"," >>> from qiskit.circuit.library import GroverOperator"," >>> oracle = QuantumCircuit(2)"," >>> oracle.z(0) # good state = first qubit is |1>"," >>> grover_op = GroverOperator(oracle, insert_barriers=True)"," >>> grover_op.decompose().draw()"," ┌───┐ ░ ┌───┐ ░ ┌───┐ ┌───┐ ░ ┌───┐"," state_0: ┤ Z ├─░─┤ H ├─░─┤ X ├───────■──┤ X ├──────░─┤ H ├"," └───┘ ░ ├───┤ ░ ├───┤┌───┐┌─┴─┐├───┤┌───┐ ░ ├───┤"," state_1: ──────░─┤ H ├─░─┤ X ├┤ H ├┤ X ├┤ H ├┤ X ├─░─┤ H ├"," ░ └───┘ ░ └───┘└───┘└───┘└───┘└───┘ ░ └───┘",""," >>> oracle = QuantumCircuit(1)"," >>> oracle.z(0) # the qubit state |1> is the good state"," >>> state_preparation = QuantumCircuit(1)"," >>> state_preparation.ry(0.2, 0) # non-uniform state preparation"," >>> grover_op = GroverOperator(oracle, state_preparation)"," >>> grover_op.decompose().draw()"," ┌───┐┌──────────┐┌───┐┌───┐┌───┐┌─────────┐"," state_0: ┤ Z ├┤ RY(-0.2) ├┤ X ├┤ Z ├┤ X ├┤ RY(0.2) ├"," └───┘└──────────┘└───┘└───┘└───┘└─────────┘",""," >>> oracle = QuantumCircuit(4)"," >>> oracle.z(3)"," >>> reflection_qubits = [0, 3]"," >>> state_preparation = QuantumCircuit(4)"," >>> state_preparation.cry(0.1, 0, 3)"," >>> state_preparation.ry(0.5, 3)"," >>> grover_op = GroverOperator(oracle, state_preparation,"," ... reflection_qubits=reflection_qubits)"," >>> grover_op.decompose().draw()"," ┌───┐ ┌───┐"," state_0: ──────────────────────■──────┤ X ├───────■──┤ X ├──────────■────────────────"," │ └───┘ │ └───┘ │"," state_1: ──────────────────────┼──────────────────┼─────────────────┼────────────────"," │ │ │"," state_2: ──────────────────────┼──────────────────┼─────────────────┼────────────────"," ┌───┐┌──────────┐┌────┴─────┐┌───┐┌───┐┌─┴─┐┌───┐┌───┐┌────┴────┐┌─────────┐"," state_3: ┤ Z ├┤ RY(-0.5) ├┤ RY(-0.1) ├┤ X ├┤ H ├┤ X ├┤ H ├┤ X ├┤ RY(0.1) ├┤ RY(0.5) ├"," └───┘└──────────┘└──────────┘└───┘└───┘└───┘└───┘└───┘└─────────┘└─────────┘",""," >>> mark_state = Statevector.from_label('011')"," >>> diffuse_operator = 2 * DensityMatrix.from_label('000') - Operator.from_label('III')"," >>> grover_op = GroverOperator(oracle=mark_state, zero_reflection=diffuse_operator)"," >>> grover_op.decompose().draw(fold=70)"," ┌─────────────────┐ ┌───┐ »"," state_0: ┤0 ├──────┤ H ├──────────────────────────»"," │ │┌─────┴───┴─────┐ ┌───┐ »"," state_1: ┤1 UCRZ(0,pi,0,0) ├┤0 ├─────┤ H ├──────────»"," │ ││ UCRZ(pi/2,0) │┌────┴───┴────┐┌───┐»"," state_2: ┤2 ├┤1 ├┤ UCRZ(-pi/4) ├┤ H ├»"," └─────────────────┘└───────────────┘└─────────────┘└───┘»"," « ┌─────────────────┐ ┌───┐"," «state_0: ┤0 ├──────┤ H ├─────────────────────────"," « │ │┌─────┴───┴─────┐ ┌───┐"," «state_1: ┤1 UCRZ(pi,0,0,0) ├┤0 ├────┤ H ├──────────"," « │ ││ UCRZ(pi/2,0) │┌───┴───┴────┐┌───┐"," «state_2: ┤2 ├┤1 ├┤ UCRZ(pi/4) ├┤ H ├"," « └─────────────────┘└───────────────┘└────────────┘└───┘",""," References:"," [1]: L. K. Grover (1996), A fast quantum mechanical algorithm for database search,"," `arXiv:quant-ph/9605043 `_."," [2]: I. Chuang & M. Nielsen, Quantum Computation and Quantum Information,"," Cambridge: Cambridge University Press, 2000. Chapter 6.1.2."," [3]: Brassard, G., Hoyer, P., Mosca, M., & Tapp, A. (2000)."," Quantum Amplitude Amplification and Estimation."," `arXiv:quant-ph/0005055 `_."," \"\"\"",""," def __init__("," self,"," oracle: Union[QuantumCircuit, Statevector],"," state_preparation: Optional[QuantumCircuit] = None,"," zero_reflection: Optional[Union[QuantumCircuit, DensityMatrix, Operator]] = None,"," reflection_qubits: Optional[List[int]] = None,"," insert_barriers: bool = False,"," mcx_mode: str = \"noancilla\","," name: str = \"Q\","," ) -> None:"," r\"\"\""," Args:"," oracle: The phase oracle implementing a reflection about the bad state. Note that this"," is not a bitflip oracle, see the docstring for more information."," state_preparation: The operator preparing the good and bad state."," For Grover's algorithm, this is a n-qubit Hadamard gate and for amplitude"," amplification or estimation the operator :math:`\\mathcal{A}`."," zero_reflection: The reflection about the zero state, :math:`\\mathcal{S}_0`."," reflection_qubits: Qubits on which the zero reflection acts on."," insert_barriers: Whether barriers should be inserted between the reflections and A."," mcx_mode: The mode to use for building the default zero reflection."," name: The name of the circuit."," \"\"\""," super().__init__(name=name)",""," # store inputs"," if isinstance(oracle, Statevector):"," from qiskit.circuit.library import Diagonal # pylint: disable=cyclic-import",""," oracle = Diagonal((-1) ** oracle.data)"," self._oracle = oracle",""," if isinstance(zero_reflection, (Operator, DensityMatrix)):"," from qiskit.circuit.library import Diagonal # pylint: disable=cyclic-import",""," zero_reflection = Diagonal(zero_reflection.data.diagonal())"," self._zero_reflection = zero_reflection",""," self._reflection_qubits = reflection_qubits"," self._state_preparation = state_preparation"," self._insert_barriers = insert_barriers"," self._mcx_mode = mcx_mode",""," # build circuit"," self._build()",""," @property"," def reflection_qubits(self):"," \"\"\"Reflection qubits, on which S0 is applied (if S0 is not user-specified).\"\"\""," if self._reflection_qubits is not None:"," return self._reflection_qubits",""," num_state_qubits = self.oracle.num_qubits - self.oracle.num_ancillas"," return list(range(num_state_qubits))",""," @property"," def zero_reflection(self) -> QuantumCircuit:"," \"\"\"The subcircuit implementing the reflection about 0.\"\"\""," if self._zero_reflection is not None:"," return self._zero_reflection",""," num_state_qubits = self.oracle.num_qubits - self.oracle.num_ancillas"," return _zero_reflection(num_state_qubits, self.reflection_qubits, self._mcx_mode)",""," @property"," def state_preparation(self) -> QuantumCircuit:"," \"\"\"The subcircuit implementing the A operator or Hadamards.\"\"\""," if self._state_preparation is not None:"," return self._state_preparation",""," num_state_qubits = self.oracle.num_qubits - self.oracle.num_ancillas"," hadamards = QuantumCircuit(num_state_qubits, name=\"H\")"," # apply Hadamards only on reflection qubits, rest will cancel out"," hadamards.h(self.reflection_qubits)"," return hadamards",""," @property"," def oracle(self):"," \"\"\"The oracle implementing a reflection about the bad state.\"\"\""," return self._oracle",""," def _build(self):"," num_state_qubits = self.oracle.num_qubits - self.oracle.num_ancillas"," circuit = QuantumCircuit(QuantumRegister(num_state_qubits, name=\"state\"), name=\"Q\")"," num_ancillas = numpy.max("," ["," self.oracle.num_ancillas,"," self.zero_reflection.num_ancillas,"," self.state_preparation.num_ancillas,"," ]"," )"," if num_ancillas > 0:"," circuit.add_register(AncillaRegister(num_ancillas, name=\"ancilla\"))",""," circuit.compose(self.oracle, list(range(self.oracle.num_qubits)), inplace=True)"," if self._insert_barriers:"," circuit.barrier()"," circuit.compose("," self.state_preparation.inverse(),"," list(range(self.state_preparation.num_qubits)),"," inplace=True,"," )"," if self._insert_barriers:"," circuit.barrier()"," circuit.compose("," self.zero_reflection, list(range(self.zero_reflection.num_qubits)), inplace=True"," )"," if self._insert_barriers:"," circuit.barrier()"," circuit.compose("," self.state_preparation, list(range(self.state_preparation.num_qubits)), inplace=True"," )",""," # minus sign"," circuit.global_phase = numpy.pi",""," self.add_register(*circuit.qregs)"," try:"," circuit_wrapped = circuit.to_gate()"," except QiskitError:"," circuit_wrapped = circuit.to_instruction()",""," self.compose(circuit_wrapped, qubits=self.qubits, inplace=True)","","","# TODO use the oracle compiler or the bit string oracle","def _zero_reflection("," num_state_qubits: int, qubits: List[int], mcx_mode: Optional[str] = None",") -> QuantumCircuit:"," qr_state = QuantumRegister(num_state_qubits, \"state\")"," reflection = QuantumCircuit(qr_state, name=\"S_0\")",""," num_ancillas = MCXGate.get_num_ancilla_qubits(len(qubits) - 1, mcx_mode)"," if num_ancillas > 0:"," qr_ancilla = AncillaRegister(num_ancillas, \"ancilla\")"," reflection.add_register(qr_ancilla)"," else:"," qr_ancilla = AncillaRegister(0)",""," reflection.x(qubits)"," if len(qubits) == 1:"," reflection.z(0) # MCX does not allow 0 control qubits, therefore this is separate"," else:"," reflection.h(qubits[-1])"," reflection.mcx(qubits[:-1], qubits[-1], qr_ancilla[:], mode=mcx_mode)"," reflection.h(qubits[-1])"," reflection.x(qubits)",""," return reflection"],"stylingDirectives":[[{"start":0,"end":30,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":31,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":70,"cssClass":"pl-c"}],[{"start":0,"end":77,"cssClass":"pl-c"}],[{"start":0,"end":71,"cssClass":"pl-c"}],[{"start":0,"end":1,"cssClass":"pl-c"}],[{"start":0,"end":69,"cssClass":"pl-c"}],[{"start":0,"end":72,"cssClass":"pl-c"}],[{"start":0,"end":49,"cssClass":"pl-c"}],[],[{"start":0,"end":26,"cssClass":"pl-s"}],[],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":16,"end":22,"cssClass":"pl-k"},{"start":23,"end":34,"cssClass":"pl-s1"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":23,"cssClass":"pl-v"},{"start":25,"end":33,"cssClass":"pl-v"},{"start":35,"end":40,"cssClass":"pl-v"}],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":12,"cssClass":"pl-s1"}],[],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":19,"cssClass":"pl-s1"},{"start":20,"end":26,"cssClass":"pl-k"},{"start":27,"end":41,"cssClass":"pl-v"},{"start":43,"end":58,"cssClass":"pl-v"},{"start":60,"end":75,"cssClass":"pl-v"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":22,"cssClass":"pl-s1"},{"start":23,"end":29,"cssClass":"pl-k"},{"start":30,"end":41,"cssClass":"pl-v"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":11,"cssClass":"pl-s1"},{"start":12,"end":24,"cssClass":"pl-s1"},{"start":25,"end":31,"cssClass":"pl-k"},{"start":32,"end":43,"cssClass":"pl-v"},{"start":45,"end":53,"cssClass":"pl-v"},{"start":55,"end":68,"cssClass":"pl-v"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":6,"end":20,"cssClass":"pl-s1"},{"start":21,"end":27,"cssClass":"pl-k"},{"start":28,"end":35,"cssClass":"pl-v"}],[],[],[{"start":0,"end":5,"cssClass":"pl-k"},{"start":6,"end":20,"cssClass":"pl-v"},{"start":21,"end":35,"cssClass":"pl-v"}],[{"start":4,"end":28,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":87,"cssClass":"pl-s"}],[{"start":0,"end":80,"cssClass":"pl-s"}],[{"start":0,"end":92,"cssClass":"pl-s"}],[{"start":0,"end":70,"cssClass":"pl-s"}],[{"start":0,"end":48,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":81,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":78,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":37,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":94,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":96,"cssClass":"pl-s"}],[{"start":0,"end":75,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":84,"cssClass":"pl-s"}],[{"start":0,"end":92,"cssClass":"pl-s"}],[{"start":0,"end":35,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":70,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":61,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":94,"cssClass":"pl-s"}],[{"start":0,"end":95,"cssClass":"pl-s"}],[{"start":0,"end":56,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":94,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":23,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":43,"cssClass":"pl-s"}],[{"start":0,"end":57,"cssClass":"pl-s"}],[{"start":0,"end":57,"cssClass":"pl-s"}],[{"start":0,"end":57,"cssClass":"pl-s"}],[{"start":0,"end":57,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":97,"cssClass":"pl-s"}],[{"start":0,"end":92,"cssClass":"pl-s"}],[{"start":0,"end":100,"cssClass":"pl-s"}],[{"start":0,"end":46,"cssClass":"pl-s"}],[{"start":0,"end":91,"cssClass":"pl-s"}],[{"start":0,"end":99,"cssClass":"pl-s"}],[{"start":0,"end":95,"cssClass":"pl-s"}],[{"start":0,"end":17,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":67,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":85,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":67,"cssClass":"pl-s"}],[{"start":0,"end":58,"cssClass":"pl-s"}],[{"start":0,"end":96,"cssClass":"pl-s"}],[{"start":0,"end":94,"cssClass":"pl-s"}],[{"start":0,"end":67,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":53,"cssClass":"pl-s"}],[{"start":0,"end":61,"cssClass":"pl-s"}],[{"start":0,"end":38,"cssClass":"pl-s"}],[{"start":0,"end":58,"cssClass":"pl-s"}],[{"start":0,"end":68,"cssClass":"pl-s"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":38,"cssClass":"pl-s"}],[{"start":0,"end":64,"cssClass":"pl-s"}],[{"start":0,"end":49,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":65,"cssClass":"pl-s"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":60,"cssClass":"pl-s"}],[{"start":0,"end":60,"cssClass":"pl-s"}],[{"start":0,"end":60,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":38,"cssClass":"pl-s"}],[{"start":0,"end":23,"cssClass":"pl-s"}],[{"start":0,"end":38,"cssClass":"pl-s"}],[{"start":0,"end":49,"cssClass":"pl-s"}],[{"start":0,"end":44,"cssClass":"pl-s"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":65,"cssClass":"pl-s"}],[{"start":0,"end":48,"cssClass":"pl-s"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":93,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":54,"cssClass":"pl-s"}],[{"start":0,"end":95,"cssClass":"pl-s"}],[{"start":0,"end":91,"cssClass":"pl-s"}],[{"start":0,"end":47,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":74,"cssClass":"pl-s"}],[{"start":0,"end":48,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":63,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":73,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":15,"cssClass":"pl-s"}],[{"start":0,"end":90,"cssClass":"pl-s"}],[{"start":0,"end":79,"cssClass":"pl-s"}],[{"start":0,"end":81,"cssClass":"pl-s"}],[{"start":0,"end":71,"cssClass":"pl-s"}],[{"start":0,"end":67,"cssClass":"pl-s"}],[{"start":0,"end":59,"cssClass":"pl-s"}],[{"start":0,"end":78,"cssClass":"pl-s"}],[{"start":0,"end":7,"cssClass":"pl-s"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":16,"cssClass":"pl-en"}],[{"start":8,"end":12,"cssClass":"pl-s1"}],[{"start":8,"end":14,"cssClass":"pl-s1"},{"start":16,"end":21,"cssClass":"pl-v"},{"start":22,"end":36,"cssClass":"pl-v"},{"start":38,"end":49,"cssClass":"pl-v"}],[{"start":8,"end":25,"cssClass":"pl-s1"},{"start":27,"end":35,"cssClass":"pl-v"},{"start":36,"end":50,"cssClass":"pl-v"},{"start":52,"end":53,"cssClass":"pl-c1"},{"start":54,"end":58,"cssClass":"pl-c1"}],[{"start":8,"end":23,"cssClass":"pl-s1"},{"start":25,"end":33,"cssClass":"pl-v"},{"start":34,"end":39,"cssClass":"pl-v"},{"start":40,"end":54,"cssClass":"pl-v"},{"start":56,"end":69,"cssClass":"pl-v"},{"start":71,"end":79,"cssClass":"pl-v"},{"start":82,"end":83,"cssClass":"pl-c1"},{"start":84,"end":88,"cssClass":"pl-c1"}],[{"start":8,"end":25,"cssClass":"pl-s1"},{"start":27,"end":35,"cssClass":"pl-v"},{"start":36,"end":40,"cssClass":"pl-v"},{"start":41,"end":44,"cssClass":"pl-s1"},{"start":47,"end":48,"cssClass":"pl-c1"},{"start":49,"end":53,"cssClass":"pl-c1"}],[{"start":8,"end":23,"cssClass":"pl-s1"},{"start":25,"end":29,"cssClass":"pl-s1"},{"start":30,"end":31,"cssClass":"pl-c1"},{"start":32,"end":37,"cssClass":"pl-c1"}],[{"start":8,"end":16,"cssClass":"pl-s1"},{"start":18,"end":21,"cssClass":"pl-s1"},{"start":22,"end":23,"cssClass":"pl-c1"},{"start":24,"end":35,"cssClass":"pl-s"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":14,"end":17,"cssClass":"pl-s1"},{"start":18,"end":19,"cssClass":"pl-c1"},{"start":20,"end":23,"cssClass":"pl-s"}],[{"start":6,"end":8,"cssClass":"pl-c1"},{"start":9,"end":13,"cssClass":"pl-c1"}],[{"start":8,"end":12,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"}],[{"start":0,"end":98,"cssClass":"pl-s"}],[{"start":0,"end":80,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":89,"cssClass":"pl-s"}],[{"start":0,"end":77,"cssClass":"pl-s"}],[{"start":0,"end":88,"cssClass":"pl-s"}],[{"start":0,"end":75,"cssClass":"pl-s"}],[{"start":0,"end":95,"cssClass":"pl-s"}],[{"start":0,"end":79,"cssClass":"pl-s"}],[{"start":0,"end":42,"cssClass":"pl-s"}],[{"start":0,"end":11,"cssClass":"pl-s"}],[{"start":8,"end":13,"cssClass":"pl-en"},{"start":16,"end":24,"cssClass":"pl-en"},{"start":25,"end":29,"cssClass":"pl-s1"},{"start":29,"end":30,"cssClass":"pl-c1"},{"start":30,"end":34,"cssClass":"pl-s1"}],[],[{"start":8,"end":22,"cssClass":"pl-c"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":21,"cssClass":"pl-en"},{"start":22,"end":28,"cssClass":"pl-s1"},{"start":30,"end":41,"cssClass":"pl-v"}],[{"start":12,"end":16,"cssClass":"pl-k"},{"start":17,"end":23,"cssClass":"pl-s1"},{"start":24,"end":31,"cssClass":"pl-s1"},{"start":32,"end":39,"cssClass":"pl-s1"},{"start":40,"end":46,"cssClass":"pl-k"},{"start":47,"end":55,"cssClass":"pl-v"},{"start":57,"end":88,"cssClass":"pl-c"}],[],[{"start":12,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-c1"},{"start":21,"end":29,"cssClass":"pl-v"},{"start":31,"end":32,"cssClass":"pl-c1"},{"start":32,"end":33,"cssClass":"pl-c1"},{"start":35,"end":37,"cssClass":"pl-c1"},{"start":38,"end":44,"cssClass":"pl-s1"},{"start":45,"end":49,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"},{"start":23,"end":29,"cssClass":"pl-s1"}],[],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":21,"cssClass":"pl-en"},{"start":22,"end":37,"cssClass":"pl-s1"},{"start":40,"end":48,"cssClass":"pl-v"},{"start":50,"end":63,"cssClass":"pl-v"}],[{"start":12,"end":16,"cssClass":"pl-k"},{"start":17,"end":23,"cssClass":"pl-s1"},{"start":24,"end":31,"cssClass":"pl-s1"},{"start":32,"end":39,"cssClass":"pl-s1"},{"start":40,"end":46,"cssClass":"pl-k"},{"start":47,"end":55,"cssClass":"pl-v"},{"start":57,"end":88,"cssClass":"pl-c"}],[],[{"start":12,"end":27,"cssClass":"pl-s1"},{"start":28,"end":29,"cssClass":"pl-c1"},{"start":30,"end":38,"cssClass":"pl-v"},{"start":39,"end":54,"cssClass":"pl-s1"},{"start":55,"end":59,"cssClass":"pl-s1"},{"start":60,"end":68,"cssClass":"pl-en"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":29,"cssClass":"pl-s1"},{"start":30,"end":31,"cssClass":"pl-c1"},{"start":32,"end":47,"cssClass":"pl-s1"}],[],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":31,"cssClass":"pl-s1"},{"start":32,"end":33,"cssClass":"pl-c1"},{"start":34,"end":51,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":31,"cssClass":"pl-s1"},{"start":32,"end":33,"cssClass":"pl-c1"},{"start":34,"end":51,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":29,"cssClass":"pl-s1"},{"start":30,"end":31,"cssClass":"pl-c1"},{"start":32,"end":47,"cssClass":"pl-s1"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":22,"cssClass":"pl-s1"},{"start":23,"end":24,"cssClass":"pl-c1"},{"start":25,"end":33,"cssClass":"pl-s1"}],[],[{"start":8,"end":23,"cssClass":"pl-c"}],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":19,"cssClass":"pl-en"}],[],[{"start":4,"end":13,"cssClass":"pl-en"},{"start":5,"end":13,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":25,"cssClass":"pl-en"},{"start":26,"end":30,"cssClass":"pl-s1"}],[{"start":8,"end":86,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":34,"cssClass":"pl-s1"},{"start":35,"end":37,"cssClass":"pl-c1"},{"start":38,"end":41,"cssClass":"pl-c1"},{"start":42,"end":46,"cssClass":"pl-c1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":23,"cssClass":"pl-s1"},{"start":24,"end":42,"cssClass":"pl-s1"}],[],[{"start":8,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"},{"start":27,"end":31,"cssClass":"pl-s1"},{"start":32,"end":38,"cssClass":"pl-s1"},{"start":39,"end":49,"cssClass":"pl-s1"},{"start":50,"end":51,"cssClass":"pl-c1"},{"start":52,"end":56,"cssClass":"pl-s1"},{"start":57,"end":63,"cssClass":"pl-s1"},{"start":64,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":19,"cssClass":"pl-en"},{"start":20,"end":25,"cssClass":"pl-en"},{"start":26,"end":42,"cssClass":"pl-s1"}],[],[{"start":4,"end":13,"cssClass":"pl-en"},{"start":5,"end":13,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":23,"cssClass":"pl-en"},{"start":24,"end":28,"cssClass":"pl-s1"},{"start":30,"end":32,"cssClass":"pl-c1"},{"start":33,"end":47,"cssClass":"pl-v"}],[{"start":8,"end":65,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":32,"cssClass":"pl-s1"},{"start":33,"end":35,"cssClass":"pl-c1"},{"start":36,"end":39,"cssClass":"pl-c1"},{"start":40,"end":44,"cssClass":"pl-c1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":23,"cssClass":"pl-s1"},{"start":24,"end":40,"cssClass":"pl-s1"}],[],[{"start":8,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"},{"start":27,"end":31,"cssClass":"pl-s1"},{"start":32,"end":38,"cssClass":"pl-s1"},{"start":39,"end":49,"cssClass":"pl-s1"},{"start":50,"end":51,"cssClass":"pl-c1"},{"start":52,"end":56,"cssClass":"pl-s1"},{"start":57,"end":63,"cssClass":"pl-s1"},{"start":64,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":31,"cssClass":"pl-en"},{"start":32,"end":48,"cssClass":"pl-s1"},{"start":50,"end":54,"cssClass":"pl-s1"},{"start":55,"end":72,"cssClass":"pl-s1"},{"start":74,"end":78,"cssClass":"pl-s1"},{"start":79,"end":88,"cssClass":"pl-s1"}],[],[{"start":4,"end":13,"cssClass":"pl-en"},{"start":5,"end":13,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":25,"cssClass":"pl-en"},{"start":26,"end":30,"cssClass":"pl-s1"},{"start":32,"end":34,"cssClass":"pl-c1"},{"start":35,"end":49,"cssClass":"pl-v"}],[{"start":8,"end":70,"cssClass":"pl-s"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":34,"cssClass":"pl-s1"},{"start":35,"end":37,"cssClass":"pl-c1"},{"start":38,"end":41,"cssClass":"pl-c1"},{"start":42,"end":46,"cssClass":"pl-c1"}],[{"start":12,"end":18,"cssClass":"pl-k"},{"start":19,"end":23,"cssClass":"pl-s1"},{"start":24,"end":42,"cssClass":"pl-s1"}],[],[{"start":8,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"},{"start":27,"end":31,"cssClass":"pl-s1"},{"start":32,"end":38,"cssClass":"pl-s1"},{"start":39,"end":49,"cssClass":"pl-s1"},{"start":50,"end":51,"cssClass":"pl-c1"},{"start":52,"end":56,"cssClass":"pl-s1"},{"start":57,"end":63,"cssClass":"pl-s1"},{"start":64,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":17,"cssClass":"pl-s1"},{"start":18,"end":19,"cssClass":"pl-c1"},{"start":20,"end":34,"cssClass":"pl-v"},{"start":35,"end":51,"cssClass":"pl-s1"},{"start":53,"end":57,"cssClass":"pl-s1"},{"start":57,"end":58,"cssClass":"pl-c1"},{"start":58,"end":61,"cssClass":"pl-s"}],[{"start":8,"end":73,"cssClass":"pl-c"}],[{"start":8,"end":17,"cssClass":"pl-s1"},{"start":18,"end":19,"cssClass":"pl-en"},{"start":20,"end":24,"cssClass":"pl-s1"},{"start":25,"end":42,"cssClass":"pl-s1"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":24,"cssClass":"pl-s1"}],[],[{"start":4,"end":13,"cssClass":"pl-en"},{"start":5,"end":13,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":14,"cssClass":"pl-en"},{"start":15,"end":19,"cssClass":"pl-s1"}],[{"start":8,"end":71,"cssClass":"pl-s"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":19,"cssClass":"pl-s1"},{"start":20,"end":27,"cssClass":"pl-s1"}],[],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":14,"cssClass":"pl-en"},{"start":15,"end":19,"cssClass":"pl-s1"}],[{"start":8,"end":24,"cssClass":"pl-s1"},{"start":25,"end":26,"cssClass":"pl-c1"},{"start":27,"end":31,"cssClass":"pl-s1"},{"start":32,"end":38,"cssClass":"pl-s1"},{"start":39,"end":49,"cssClass":"pl-s1"},{"start":50,"end":51,"cssClass":"pl-c1"},{"start":52,"end":56,"cssClass":"pl-s1"},{"start":57,"end":63,"cssClass":"pl-s1"},{"start":64,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":17,"cssClass":"pl-c1"},{"start":18,"end":32,"cssClass":"pl-v"},{"start":33,"end":48,"cssClass":"pl-v"},{"start":49,"end":65,"cssClass":"pl-s1"},{"start":67,"end":71,"cssClass":"pl-s1"},{"start":71,"end":72,"cssClass":"pl-c1"},{"start":72,"end":79,"cssClass":"pl-s"},{"start":82,"end":86,"cssClass":"pl-s1"},{"start":86,"end":87,"cssClass":"pl-c1"},{"start":87,"end":90,"cssClass":"pl-s"}],[{"start":8,"end":20,"cssClass":"pl-s1"},{"start":21,"end":22,"cssClass":"pl-c1"},{"start":23,"end":28,"cssClass":"pl-s1"},{"start":29,"end":32,"cssClass":"pl-en"}],[],[{"start":16,"end":20,"cssClass":"pl-s1"},{"start":21,"end":27,"cssClass":"pl-s1"},{"start":28,"end":40,"cssClass":"pl-s1"}],[{"start":16,"end":20,"cssClass":"pl-s1"},{"start":21,"end":36,"cssClass":"pl-s1"},{"start":37,"end":49,"cssClass":"pl-s1"}],[{"start":16,"end":20,"cssClass":"pl-s1"},{"start":21,"end":38,"cssClass":"pl-s1"},{"start":39,"end":51,"cssClass":"pl-s1"}],[],[],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":23,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":27,"cssClass":"pl-c1"}],[{"start":12,"end":19,"cssClass":"pl-s1"},{"start":20,"end":32,"cssClass":"pl-en"},{"start":33,"end":48,"cssClass":"pl-v"},{"start":49,"end":61,"cssClass":"pl-s1"},{"start":63,"end":67,"cssClass":"pl-s1"},{"start":67,"end":68,"cssClass":"pl-c1"},{"start":68,"end":77,"cssClass":"pl-s"}],[],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-en"},{"start":24,"end":28,"cssClass":"pl-s1"},{"start":29,"end":35,"cssClass":"pl-s1"},{"start":37,"end":41,"cssClass":"pl-en"},{"start":42,"end":47,"cssClass":"pl-en"},{"start":48,"end":52,"cssClass":"pl-s1"},{"start":53,"end":59,"cssClass":"pl-s1"},{"start":60,"end":70,"cssClass":"pl-s1"},{"start":74,"end":81,"cssClass":"pl-s1"},{"start":81,"end":82,"cssClass":"pl-c1"},{"start":82,"end":86,"cssClass":"pl-c1"}],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":32,"cssClass":"pl-s1"}],[{"start":12,"end":19,"cssClass":"pl-s1"},{"start":20,"end":27,"cssClass":"pl-en"}],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-en"}],[{"start":12,"end":16,"cssClass":"pl-s1"},{"start":17,"end":34,"cssClass":"pl-s1"},{"start":35,"end":42,"cssClass":"pl-en"}],[{"start":12,"end":16,"cssClass":"pl-en"},{"start":17,"end":22,"cssClass":"pl-en"},{"start":23,"end":27,"cssClass":"pl-s1"},{"start":28,"end":45,"cssClass":"pl-s1"},{"start":46,"end":56,"cssClass":"pl-s1"}],[{"start":12,"end":19,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-c1"},{"start":20,"end":24,"cssClass":"pl-c1"}],[],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":32,"cssClass":"pl-s1"}],[{"start":12,"end":19,"cssClass":"pl-s1"},{"start":20,"end":27,"cssClass":"pl-en"}],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-en"}],[{"start":12,"end":16,"cssClass":"pl-s1"},{"start":17,"end":32,"cssClass":"pl-s1"},{"start":34,"end":38,"cssClass":"pl-en"},{"start":39,"end":44,"cssClass":"pl-en"},{"start":45,"end":49,"cssClass":"pl-s1"},{"start":50,"end":65,"cssClass":"pl-s1"},{"start":66,"end":76,"cssClass":"pl-s1"},{"start":80,"end":87,"cssClass":"pl-s1"},{"start":87,"end":88,"cssClass":"pl-c1"},{"start":88,"end":92,"cssClass":"pl-c1"}],[],[{"start":8,"end":10,"cssClass":"pl-k"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":16,"end":32,"cssClass":"pl-s1"}],[{"start":12,"end":19,"cssClass":"pl-s1"},{"start":20,"end":27,"cssClass":"pl-en"}],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":23,"cssClass":"pl-en"}],[{"start":12,"end":16,"cssClass":"pl-s1"},{"start":17,"end":34,"cssClass":"pl-s1"},{"start":36,"end":40,"cssClass":"pl-en"},{"start":41,"end":46,"cssClass":"pl-en"},{"start":47,"end":51,"cssClass":"pl-s1"},{"start":52,"end":69,"cssClass":"pl-s1"},{"start":70,"end":80,"cssClass":"pl-s1"},{"start":84,"end":91,"cssClass":"pl-s1"},{"start":91,"end":92,"cssClass":"pl-c1"},{"start":92,"end":96,"cssClass":"pl-c1"}],[],[],[{"start":8,"end":20,"cssClass":"pl-c"}],[{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":28,"cssClass":"pl-s1"},{"start":29,"end":30,"cssClass":"pl-c1"},{"start":31,"end":36,"cssClass":"pl-s1"},{"start":37,"end":39,"cssClass":"pl-s1"}],[],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":25,"cssClass":"pl-en"},{"start":26,"end":27,"cssClass":"pl-c1"},{"start":27,"end":34,"cssClass":"pl-s1"},{"start":35,"end":40,"cssClass":"pl-s1"}],[{"start":8,"end":11,"cssClass":"pl-k"}],[{"start":12,"end":27,"cssClass":"pl-s1"},{"start":28,"end":29,"cssClass":"pl-c1"},{"start":30,"end":37,"cssClass":"pl-s1"},{"start":38,"end":45,"cssClass":"pl-en"}],[{"start":8,"end":14,"cssClass":"pl-k"},{"start":15,"end":26,"cssClass":"pl-v"}],[{"start":12,"end":27,"cssClass":"pl-s1"},{"start":28,"end":29,"cssClass":"pl-c1"},{"start":30,"end":37,"cssClass":"pl-s1"},{"start":38,"end":52,"cssClass":"pl-en"}],[],[{"start":8,"end":12,"cssClass":"pl-s1"},{"start":13,"end":20,"cssClass":"pl-en"},{"start":21,"end":36,"cssClass":"pl-s1"},{"start":38,"end":44,"cssClass":"pl-s1"},{"start":44,"end":45,"cssClass":"pl-c1"},{"start":45,"end":49,"cssClass":"pl-s1"},{"start":50,"end":56,"cssClass":"pl-s1"},{"start":58,"end":65,"cssClass":"pl-s1"},{"start":65,"end":66,"cssClass":"pl-c1"},{"start":66,"end":70,"cssClass":"pl-c1"}],[],[],[{"start":0,"end":55,"cssClass":"pl-c"}],[{"start":0,"end":3,"cssClass":"pl-k"},{"start":4,"end":20,"cssClass":"pl-en"}],[{"start":4,"end":20,"cssClass":"pl-s1"},{"start":22,"end":25,"cssClass":"pl-s1"},{"start":27,"end":33,"cssClass":"pl-s1"},{"start":35,"end":39,"cssClass":"pl-v"},{"start":40,"end":43,"cssClass":"pl-s1"},{"start":46,"end":54,"cssClass":"pl-s1"},{"start":56,"end":64,"cssClass":"pl-v"},{"start":65,"end":68,"cssClass":"pl-s1"},{"start":70,"end":71,"cssClass":"pl-c1"},{"start":72,"end":76,"cssClass":"pl-c1"}],[{"start":2,"end":4,"cssClass":"pl-c1"},{"start":5,"end":19,"cssClass":"pl-v"}],[{"start":4,"end":12,"cssClass":"pl-s1"},{"start":13,"end":14,"cssClass":"pl-c1"},{"start":15,"end":30,"cssClass":"pl-v"},{"start":31,"end":47,"cssClass":"pl-s1"},{"start":49,"end":56,"cssClass":"pl-s"}],[{"start":4,"end":14,"cssClass":"pl-s1"},{"start":15,"end":16,"cssClass":"pl-c1"},{"start":17,"end":31,"cssClass":"pl-v"},{"start":32,"end":40,"cssClass":"pl-s1"},{"start":42,"end":46,"cssClass":"pl-s1"},{"start":46,"end":47,"cssClass":"pl-c1"},{"start":47,"end":52,"cssClass":"pl-s"}],[],[{"start":4,"end":16,"cssClass":"pl-s1"},{"start":17,"end":18,"cssClass":"pl-c1"},{"start":19,"end":26,"cssClass":"pl-v"},{"start":27,"end":49,"cssClass":"pl-en"},{"start":50,"end":53,"cssClass":"pl-en"},{"start":54,"end":60,"cssClass":"pl-s1"},{"start":62,"end":63,"cssClass":"pl-c1"},{"start":64,"end":65,"cssClass":"pl-c1"},{"start":67,"end":75,"cssClass":"pl-s1"}],[{"start":4,"end":6,"cssClass":"pl-k"},{"start":7,"end":19,"cssClass":"pl-s1"},{"start":20,"end":21,"cssClass":"pl-c1"},{"start":22,"end":23,"cssClass":"pl-c1"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-c1"},{"start":21,"end":36,"cssClass":"pl-v"},{"start":37,"end":49,"cssClass":"pl-s1"},{"start":51,"end":60,"cssClass":"pl-s"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":31,"cssClass":"pl-en"},{"start":32,"end":42,"cssClass":"pl-s1"}],[{"start":4,"end":8,"cssClass":"pl-k"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-c1"},{"start":21,"end":36,"cssClass":"pl-v"},{"start":37,"end":38,"cssClass":"pl-c1"}],[],[{"start":4,"end":14,"cssClass":"pl-s1"},{"start":15,"end":16,"cssClass":"pl-en"},{"start":17,"end":23,"cssClass":"pl-s1"}],[{"start":4,"end":6,"cssClass":"pl-k"},{"start":7,"end":10,"cssClass":"pl-en"},{"start":11,"end":17,"cssClass":"pl-s1"},{"start":19,"end":21,"cssClass":"pl-c1"},{"start":22,"end":23,"cssClass":"pl-c1"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-en"},{"start":21,"end":22,"cssClass":"pl-c1"},{"start":25,"end":90,"cssClass":"pl-c"}],[{"start":4,"end":8,"cssClass":"pl-k"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-en"},{"start":21,"end":27,"cssClass":"pl-s1"},{"start":28,"end":29,"cssClass":"pl-c1"},{"start":29,"end":30,"cssClass":"pl-c1"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":22,"cssClass":"pl-en"},{"start":23,"end":29,"cssClass":"pl-s1"},{"start":31,"end":32,"cssClass":"pl-c1"},{"start":32,"end":33,"cssClass":"pl-c1"},{"start":36,"end":42,"cssClass":"pl-s1"},{"start":43,"end":44,"cssClass":"pl-c1"},{"start":44,"end":45,"cssClass":"pl-c1"},{"start":48,"end":58,"cssClass":"pl-s1"},{"start":63,"end":67,"cssClass":"pl-s1"},{"start":67,"end":68,"cssClass":"pl-c1"},{"start":68,"end":76,"cssClass":"pl-s1"}],[{"start":8,"end":18,"cssClass":"pl-s1"},{"start":19,"end":20,"cssClass":"pl-en"},{"start":21,"end":27,"cssClass":"pl-s1"},{"start":28,"end":29,"cssClass":"pl-c1"},{"start":29,"end":30,"cssClass":"pl-c1"}],[{"start":4,"end":14,"cssClass":"pl-s1"},{"start":15,"end":16,"cssClass":"pl-en"},{"start":17,"end":23,"cssClass":"pl-s1"}],[],[{"start":4,"end":10,"cssClass":"pl-k"},{"start":11,"end":21,"cssClass":"pl-s1"}]],"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Qiskit/qiskit/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"grover_operator.py","displayUrl":"https://github.com/Qiskit/qiskit/blob/main/qiskit/circuit/library/grover_operator.py?raw=true","headerInfo":{"blobSize":"16.3 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"9cf48e2","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FQiskit%2Fqiskit%2Fblob%2Fmain%2Fqiskit%2Fcircuit%2Flibrary%2Fgrover_operator.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"311","truncatedSloc":"261"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Qiskit/qiskit/blob/main/qiskit/circuit/library/grover_operator.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/Qiskit/qiskit/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/Qiskit/qiskit/raw/main/qiskit/circuit/library/grover_operator.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":4,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"GroverOperator","kind":"class","ident_start":833,"ident_end":847,"extent_start":827,"extent_end":15802,"fully_qualified_name":"GroverOperator","ident_utf16":{"start":{"line_number":24,"utf16_col":6},"end":{"line_number":24,"utf16_col":20}},"extent_utf16":{"start":{"line_number":24,"utf16_col":0},"end":{"line_number":284,"utf16_col":71}}},{"name":"__init__","kind":"function","ident_start":10838,"ident_end":10846,"extent_start":10834,"extent_end":12870,"fully_qualified_name":"GroverOperator.__init__","ident_utf16":{"start":{"line_number":162,"utf16_col":8},"end":{"line_number":162,"utf16_col":16}},"extent_utf16":{"start":{"line_number":162,"utf16_col":4},"end":{"line_number":206,"utf16_col":21}}},{"name":"reflection_qubits","kind":"function","ident_start":12894,"ident_end":12911,"extent_start":12890,"extent_end":13219,"fully_qualified_name":"GroverOperator.reflection_qubits","ident_utf16":{"start":{"line_number":209,"utf16_col":8},"end":{"line_number":209,"utf16_col":25}},"extent_utf16":{"start":{"line_number":209,"utf16_col":4},"end":{"line_number":215,"utf16_col":44}}},{"name":"zero_reflection","kind":"function","ident_start":13243,"ident_end":13258,"extent_start":13239,"extent_end":13604,"fully_qualified_name":"GroverOperator.zero_reflection","ident_utf16":{"start":{"line_number":218,"utf16_col":8},"end":{"line_number":218,"utf16_col":23}},"extent_utf16":{"start":{"line_number":218,"utf16_col":4},"end":{"line_number":224,"utf16_col":89}}},{"name":"state_preparation","kind":"function","ident_start":13628,"ident_end":13645,"extent_start":13624,"extent_end":14116,"fully_qualified_name":"GroverOperator.state_preparation","ident_utf16":{"start":{"line_number":227,"utf16_col":8},"end":{"line_number":227,"utf16_col":25}},"extent_utf16":{"start":{"line_number":227,"utf16_col":4},"end":{"line_number":236,"utf16_col":24}}},{"name":"oracle","kind":"function","ident_start":14140,"ident_end":14146,"extent_start":14136,"extent_end":14253,"fully_qualified_name":"GroverOperator.oracle","ident_utf16":{"start":{"line_number":239,"utf16_col":8},"end":{"line_number":239,"utf16_col":14}},"extent_utf16":{"start":{"line_number":239,"utf16_col":4},"end":{"line_number":241,"utf16_col":27}}},{"name":"_build","kind":"function","ident_start":14263,"ident_end":14269,"extent_start":14259,"extent_end":15802,"fully_qualified_name":"GroverOperator._build","ident_utf16":{"start":{"line_number":243,"utf16_col":8},"end":{"line_number":243,"utf16_col":14}},"extent_utf16":{"start":{"line_number":243,"utf16_col":4},"end":{"line_number":284,"utf16_col":71}}},{"name":"_zero_reflection","kind":"function","ident_start":15865,"ident_end":15881,"extent_start":15861,"extent_end":16695,"fully_qualified_name":"_zero_reflection","ident_utf16":{"start":{"line_number":288,"utf16_col":4},"end":{"line_number":288,"utf16_col":20}},"extent_utf16":{"start":{"line_number":288,"utf16_col":0},"end":{"line_number":310,"utf16_col":21}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/Qiskit/qiskit/branches":{"post":"FtiFv12gFdpothWHlmjOkpTgiy1aBB_IXJ75ah_d0svUhdKuE2LLAK-fho-Aqo8xYFDfQiAGEPvMDtR9R11rtQ"},"/repos/preferences":{"post":"tkmuzRiCRWfWf8dZU0nYebaUVl_6_9G24QQf2n9_TqYBKr_QrCrfwtx27jT1Qw2-rM5CTbSHo0VHBRFVvsP0pg"}}},"title":"qiskit/qiskit/circuit/library/grover_operator.py at main · Qiskit/qiskit"}