"""GHZ state (:mod:`qurry.recipe.simple.cat`)The entangled circuit :class:`~qurry.recipe.simple.cat.GHZ`as known as :class:`~qurry.recipe.simple.cat.Cat`,which has been mentioned in the following reference.Reference: - Measurement of the Entanglement Spectrum of a Symmetry-Protected Topological State Using the IBM Quantum Computer - Choo, Kenny and von Keyserlingk, Curt W. and Regnault, Nicolas and Neupert, Titus `doi:10.1103/PhysRevLett.121.086808 <https://doi.org/10.1103/PhysRevLett.121.086808>`_ .. code-block:: bibtex @article{PhysRevLett.121.086808, title = { Measurement of the Entanglement Spectrum of a Symmetry-Protected Topological State Using the IBM Quantum Computer}, author = { Choo, Kenny and von Keyserlingk, Curt W. and Regnault, Nicolas and Neupert, Titus}, journal = {Phys. Rev. Lett.}, volume = {121}, issue = {8}, pages = {086808}, numpages = {5}, year = {2018}, month = {Aug}, publisher = {American Physical Society}, doi = {10.1103/PhysRevLett.121.086808}, url = {https://link.aps.org/doi/10.1103/PhysRevLett.121.086808} }"""from..n_bodyimportOneBody
[docs]classGHZ(OneBody):r"""The entangled circuit :class:`~qurry.recipe.simple.cat.GHZ`. .. code-block:: text # Open boundary at 8 qubits: ┌───┐ q0: ┤ H ├──■──────────────────────────────── └───┘┌─┴─┐ q1: ─────┤ X ├──■─────────────────────────── └───┘┌─┴─┐ q2: ──────────┤ X ├──■────────────────────── └───┘┌─┴─┐ q3: ───────────────┤ X ├──■───────────────── └───┘┌─┴─┐ q4: ────────────────────┤ X ├──■──────────── └───┘┌─┴─┐ q5: ─────────────────────────┤ X ├──■─────── └───┘┌─┴─┐ q6: ──────────────────────────────┤ X ├──■── └───┘┌─┴─┐ q7: ───────────────────────────────────┤ X ├ └───┘ .. math:: \frac{1}{\sqrt{2}} \left({|01\rangle} - {|10\rangle} \right)^{\otimes N/2}, N = 8 Args: num_qubits (int): The number of qubits for constructing the example circuit. name (str, optional): Name of case. Defaults to "ghz". """def__init__(self,num_qubits:int,name:str="ghz")->None:super().__init__(name=name)self.num_qubits=num_qubitsdef_build(self)->None:ifself._is_built:returnsuper()._build()num_qubits=self.num_qubitsifnum_qubits==0:returnself.h(0)foriinrange(1,num_qubits):self.cx(i-1,i)
[docs]classCat(GHZ):r""":class:`~qurry.recipe.simple.cat.Cat`, the anthor name of entangled circuit :class:`~qurry.recipe.simple.cat.GHZ`. .. code-block:: text # Open boundary at 8 qubits: ┌───┐ q0: ┤ H ├──■──────────────────────────────── └───┘┌─┴─┐ q1: ─────┤ X ├──■─────────────────────────── └───┘┌─┴─┐ q2: ──────────┤ X ├──■────────────────────── └───┘┌─┴─┐ q3: ───────────────┤ X ├──■───────────────── └───┘┌─┴─┐ q4: ────────────────────┤ X ├──■──────────── └───┘┌─┴─┐ q5: ─────────────────────────┤ X ├──■─────── └───┘┌─┴─┐ q6: ──────────────────────────────┤ X ├──■── └───┘┌─┴─┐ q7: ───────────────────────────────────┤ X ├ └───┘ .. math:: \frac{1}{\sqrt{2}} \left({|01\rangle} - {|10\rangle} \right)^{\otimes N/2}, N = 8 Args: num_qubits (int): The number of qubits for constructing the example circuit. name (str, optional): Name of case. Defaults to "cat". """def__init__(self,num_qubits:int,name:str="cat")->None:super().__init__(num_qubits=num_qubits,name=name)self.num_qubits=num_qubits