index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30,313 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/diagonal.py | 158,159 | 1,166 | _extract_rz | 163,166 | 159,166 | # 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 derivat... | # 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 derivat... | phase = (phi1 + phi2) / 2.0
z_angle = phi2 - phi1
return phase, z_angle
| """
Extract a Rz rotation (angle given by first output) such that exp(j*phase)*Rz(z_angle)
is equal to the diagonal matrix with entires exp(1j*ph1) and exp(1j*ph2).
"""
phase = (phi1 + phi2) / 2.0
z_angle = phi2 - phi1
return phase, z_angle
| 15 | 1,843 | 41 | 1,884 | # 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 derivat... | # 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 derivat... | |
30,314 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/diagonal.py | 117,119 | 32,129 | _check_input | Diagonal | 120,129 | 119,129 | class Diagonal(QuantumCircuit):
r"""Diagonal circuit.
Circuit symbol:
.. parsed-literal::
┌───────────┐
q_0: ┤0 ├
│ │
q_1: ┤1 Diagonal ├
│ │
q_2: ┤2 ├
└───────────┘
Matrix form:
.. ... | class Diagonal(QuantumCircuit):
r"""Diagonal circuit.
Circuit symbol:
.. parsed-literal::
┌───────────┐
q_0: ┤0 ├
│ │
q_1: ┤1 Diagonal ├
│ │
q_2: ┤2 ├
└───────────┘
Matrix form:
.. ... | if not isinstance(diag, (list, np.ndarray)):
raise CircuitError("Diagonal entries must be in a list or numpy array.")
num_qubits = math.log2(len(diag))
if num_qubits < 1 or not num_qubits.is_integer():
raise CircuitError("The number of diagonal entries is not a positive p... | """Check if ``diag`` is in valid format."""
if not isinstance(diag, (list, np.ndarray)):
raise CircuitError("Diagonal entries must be in a list or numpy array.")
num_qubits = math.log2(len(diag))
if num_qubits < 1 or not num_qubits.is_integer():
raise CircuitError... | 54 | 1,089 | 148 | 1,237 | # 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 derivat... | # 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 derivat... |
30,315 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/diagonal.py | 145,146 | 129,158 | validate_parameter | DiagonalGate | 148,153 | 146,153 | class DiagonalGate(Gate):
"""Gate implementing a diagonal transformation."""
def __init__(self, diag: Sequence[complex]) -> None:
r"""
Args:
diag: list of the :math:`2^k` diagonal entries (for a diagonal gate on :math:`k` qubits).
"""
Diagonal._check_input(diag)
... | class DiagonalGate(Gate):
"""Gate implementing a diagonal transformation."""
def __init__(self, diag: Sequence[complex]) -> None:
r"""
Args:
diag: list of the :math:`2^k` diagonal entries (for a diagonal gate on :math:`k` qubits).
"""
Diagonal._check_input(diag)
... | if isinstance(parameter, complex):
return complex(parameter)
else:
return complex(super().validate_parameter(parameter))
| """Diagonal Gate parameter should accept complex
(in addition to the Gate parameter types) and always return build-in complex."""
if isinstance(parameter, complex):
return complex(parameter)
else:
return complex(super().validate_parameter(parameter))
| 8 | 259 | 40 | 299 | # 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 derivat... | # 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 derivat... |
30,316 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/gms.py | 113,114 | 96,122 | _define | MSGate | 114,122 | 114,122 | class MSGate(Gate):
"""MSGate has been deprecated.
Please use ``GMS`` in ``qiskit.circuit.generalized_gates`` instead.
Global Mølmer–Sørensen gate.
The Mølmer–Sørensen gate is native to ion-trap systems. The global MS can be
applied to multiple ions to entangle multiple qubits simultaneously.
... | class MSGate(Gate):
"""MSGate has been deprecated.
Please use ``GMS`` in ``qiskit.circuit.generalized_gates`` instead.
Global Mølmer–Sørensen gate.
The Mølmer–Sørensen gate is native to ion-trap systems. The global MS can be
applied to multiple ions to entangle multiple qubits simultaneously.
... | theta = self.params[0]
q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
for i in range(self.num_qubits):
for j in range(i + 1, self.num_qubits):
qc._append(RXXGate(theta), [q[i], q[j]], [])
self.definition = qc
| theta = self.params[0]
q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
for i in range(self.num_qubits):
for j in range(i + 1, self.num_qubits):
qc._append(RXXGate(theta), [q[i], q[j]], [])
self.definition = qc
| 29 | 211 | 122 | 333 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 wo... |
30,318 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/mcg_up_to_diagonal.py | 130,131 | 33,144 | _define_qubit_role | MCGupDiag | 131,138 | 131,138 | class MCGupDiag(Gate):
r"""
Decomposes a multi-controlled gate :math:`U` up to a diagonal :math:`D` acting on the control
and target qubit (but not on the ancilla qubits), i.e., it implements a circuit corresponding to
a unitary :math:`U'`, such that :math:`U = D U'`.
"""
def __init__(
... | class MCGupDiag(Gate):
r"""
Decomposes a multi-controlled gate :math:`U` up to a diagonal :math:`D` acting on the control
and target qubit (but not on the ancilla qubits), i.e., it implements a circuit corresponding to
a unitary :math:`U'`, such that :math:`U = D U'`.
"""
def __init__(
... | # Define the role of the qubits
q_target = q[0]
q_controls = q[1 : self.num_controls + 1]
q_ancillas_zero = q[self.num_controls + 1 : self.num_controls + 1 + self.num_ancillas_zero]
q_ancillas_dirty = q[self.num_controls + 1 + self.num_ancillas_zero :]
return q_target, q_... | # Define the role of the qubits
q_target = q[0]
q_controls = q[1 : self.num_controls + 1]
q_ancillas_zero = q[self.num_controls + 1 : self.num_controls + 1 + self.num_ancillas_zero]
q_ancillas_dirty = q[self.num_controls + 1 + self.num_ancillas_zero :]
return q_target, q_... | 41 | 1,489 | 143 | 1,632 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 wo... |
30,319 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/mcmt.py | 106,107 | 27,158 | _identify_gate | MCMT | 108,145 | 107,145 | class MCMT(QuantumCircuit):
"""The multi-controlled multi-target gate, for an arbitrary singly controlled target gate.
For example, the H gate controlled on 3 qubits and acting on 2 target qubit is represented as:
.. parsed-literal::
───■────
│
───■────
│
───... | class MCMT(QuantumCircuit):
"""The multi-controlled multi-target gate, for an arbitrary singly controlled target gate.
For example, the H gate controlled on 3 qubits and acting on 2 target qubit is represented as:
.. parsed-literal::
───■────
│
───■────
│
───... | valid_gates = {
"ch": HGate(),
"cx": XGate(),
"cy": YGate(),
"cz": ZGate(),
"h": HGate(),
"s": SGate(),
"sdg": SdgGate(),
"x": XGate(),
"y": YGate(),
"z": ZGate(),
"t": TGate(),
... | """Case the gate input to a gate."""
valid_gates = {
"ch": HGate(),
"cx": XGate(),
"cy": YGate(),
"cz": ZGate(),
"h": HGate(),
"s": SGate(),
"sdg": SdgGate(),
"x": XGate(),
"y": YGate(),
... | 117 | 1,116 | 397 | 1,513 | # 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 derivat... | # 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 derivat... |
30,320 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/mcmt.py | 194,195 | 158,257 | _build | MCMTVChain | 196,212 | 195,212 | class MCMTVChain(MCMT):
"""The MCMT implementation using the CCX V-chain.
This implementation requires ancillas but is decomposed into a much shallower circuit
than the default implementation in :class:`~qiskit.circuit.library.MCMT`.
**Expanded Circuit:**
.. plot::
from qiskit.circuit.lib... | class MCMTVChain(MCMT):
"""The MCMT implementation using the CCX V-chain.
This implementation requires ancillas but is decomposed into a much shallower circuit
than the default implementation in :class:`~qiskit.circuit.library.MCMT`.
**Expanded Circuit:**
.. plot::
from qiskit.circuit.lib... | control_qubits = self.qubits[: self.num_ctrl_qubits]
target_qubits = self.qubits[
self.num_ctrl_qubits : self.num_ctrl_qubits + self.num_target_qubits
]
ancilla_qubits = self.qubits[self.num_ctrl_qubits + self.num_target_qubits :]
if len(ancilla_qubits) > 0:
... | """Define the MCMT gate."""
control_qubits = self.qubits[: self.num_ctrl_qubits]
target_qubits = self.qubits[
self.num_ctrl_qubits : self.num_ctrl_qubits + self.num_target_qubits
]
ancilla_qubits = self.qubits[self.num_ctrl_qubits + self.num_target_qubits :]
... | 44 | 1,118 | 249 | 1,367 | # 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 derivat... | # 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 derivat... |
30,321 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/pauli.py | 74,75 | 26,86 | validate_parameter | PauliGate | 75,86 | 75,86 | class PauliGate(Gate):
r"""A multi-qubit Pauli gate.
This gate exists for optimization purposes for the
quantum statevector simulation, since applying multiple
pauli gates to different qubits at once can be done via
a single pass on the statevector.
The functionality is equivalent to applying
... | class PauliGate(Gate):
r"""A multi-qubit Pauli gate.
This gate exists for optimization purposes for the
quantum statevector simulation, since applying multiple
pauli gates to different qubits at once can be done via
a single pass on the statevector.
The functionality is equivalent to applying
... | if isinstance(parameter, str):
if all(c in ["I", "X", "Y", "Z"] for c in parameter):
return parameter
else:
raise CircuitError(
f"Parameter string {parameter} should contain only 'I', 'X', 'Y', 'Z' characters"
)
... | if isinstance(parameter, str):
if all(c in ["I", "X", "Y", "Z"] for c in parameter):
return parameter
else:
raise CircuitError(
f"Parameter string {parameter} should contain only 'I', 'X', 'Y', 'Z' characters"
)
... | 47 | 583 | 128 | 711 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wor... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wor... |
30,322 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/permutation.py | 172,174 | 97,194 | pattern | PermutationGate | 175,177 | 174,177 | class PermutationGate(Gate):
"""A gate that permutes qubits."""
def __init__(
self,
pattern: list[int],
) -> None:
"""Return a permutation gate.
Args:
pattern: permutation pattern, describing which qubits occupy the
positions 0, 1, 2, etc. after ... | class PermutationGate(Gate):
"""A gate that permutes qubits."""
def __init__(
self,
pattern: list[int],
) -> None:
"""Return a permutation gate.
Args:
pattern: permutation pattern, describing which qubits occupy the
positions 0, 1, 2, etc. after ... | return self.params[0]
| """Returns the permutation pattern defining this permutation."""
return self.params[0]
| 2 | 1,088 | 12 | 1,100 | # 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 derivat... | # 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 derivat... |
30,323 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/rv.py | 83,84 | 21,98 | to_matrix | RVGate | 85,98 | 84,98 | class RVGate(Gate):
r"""Rotation around arbitrary rotation axis :math:`\vec{v}` where :math:`\|\vec{v}\|_2` is
angle of rotation in radians.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rv` method.
**Circuit symbol:**
.. parsed-lit... | class RVGate(Gate):
r"""Rotation around arbitrary rotation axis :math:`\vec{v}` where :math:`\|\vec{v}\|_2` is
angle of rotation in radians.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rv` method.
**Circuit symbol:**
.. parsed-lit... | v = numpy.asarray(self.params, dtype=float)
angle = math.sqrt(v.dot(v))
if angle == 0:
return numpy.array([[1, 0], [0, 1]])
nx, ny, nz = v / angle
sin = math.sin(angle / 2)
cos = math.cos(angle / 2)
return numpy.array(
[
[co... | """Return a numpy.array for the R(v) gate."""
v = numpy.asarray(self.params, dtype=float)
angle = math.sqrt(v.dot(v))
if angle == 0:
return numpy.array([[1, 0], [0, 1]])
nx, ny, nz = v / angle
sin = math.sin(angle / 2)
cos = math.cos(angle / 2)
... | 66 | 855 | 184 | 1,039 | # 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 derivati... | # 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 derivati... |
30,324 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/uc_pauli_rot.py | 77,78 | 32,165 | _dec_ucrot | UCPauliRotGate | 82,132 | 78,132 | class UCPauliRotGate(Gate):
r"""Uniformly controlled Pauli rotations.
Implements the :class:`.UCGate` for the special case that all unitaries are Pauli rotations,
:math:`U_i = R_P(a_i)` where :math:`P \in \{X, Y, Z\}` and :math:`a_i \in \mathbb{R}` is
the rotation angle.
"""
def __init__(self,... | class UCPauliRotGate(Gate):
r"""Uniformly controlled Pauli rotations.
Implements the :class:`.UCGate` for the special case that all unitaries are Pauli rotations,
:math:`U_i = R_P(a_i)` where :math:`P \in \{X, Y, Z\}` and :math:`a_i \in \mathbb{R}` is
the rotation angle.
"""
def __init__(self,... | q = QuantumRegister(self.num_qubits, "q")
circuit = QuantumCircuit(q)
q_target = q[0]
q_controls = q[1:]
if not q_controls: # equivalent to: if len(q_controls) == 0
if self.rot_axes == "X":
if np.abs(self.params[0]) > _EPS:
circuit... | """
Finds a decomposition of a UC rotation gate into elementary gates
(C-NOTs and single-qubit rotations).
"""
q = QuantumRegister(self.num_qubits, "q")
circuit = QuantumCircuit(q)
q_target = q[0]
q_controls = q[1:]
if not q_controls: # equivalent... | 259 | 1,113 | 775 | 1,888 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... |
30,325 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/generalized_gates/unitary.py | 137,138 | 39,216 | _define | UnitaryGate | 139,163 | 138,163 | class UnitaryGate(Gate):
"""Class quantum gates specified by a unitary matrix.
Example:
We can create a unitary gate from a unitary matrix then add it to a
quantum circuit. The matrix can also be directly applied to the quantum
circuit, see :meth:`.QuantumCircuit.unitary`.
.. ... | class UnitaryGate(Gate):
"""Class quantum gates specified by a unitary matrix.
Example:
We can create a unitary gate from a unitary matrix then add it to a
quantum circuit. The matrix can also be directly applied to the quantum
circuit, see :meth:`.QuantumCircuit.unitary`.
.. ... | if self.num_qubits == 1:
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
theta, phi, lam, global_phase = OneQubitEulerDecomposer("U").angles_and_phase(
... | """Calculate a subcircuit that implements this unitary."""
if self.num_qubits == 1:
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
theta, phi, lam, glob... | 64 | 1,684 | 356 | 2,040 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2024.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2024.
#
# 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 derivat... |
30,328 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/hamiltonian_gate.py | 129,130 | 39,144 | _define | HamiltonianGate | 131,136 | 130,136 | class HamiltonianGate(Gate):
r"""Class for representing evolution by a Hamiltonian operator as a gate.
This gate resolves to a :class:`~.library.UnitaryGate` as :math:`U(t) = \exp(-i t H)`,
which can be decomposed into basis gates if it is 2 qubits or less, or
simulated directly in Aer for more qubits.... | class HamiltonianGate(Gate):
r"""Class for representing evolution by a Hamiltonian operator as a gate.
This gate resolves to a :class:`~.library.UnitaryGate` as :math:`U(t) = \exp(-i t H)`,
which can be decomposed into basis gates if it is 2 qubits or less, or
simulated directly in Aer for more qubits.... | q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
qc._append(UnitaryGate(self.to_matrix()), q[:], [])
self.definition = qc
| """Calculate a subcircuit that implements this unitary."""
q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
qc._append(UnitaryGate(self.to_matrix()), q[:], [])
self.definition = qc
| 14 | 1,172 | 73 | 1,245 | # 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 derivat... | # 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 derivat... |
30,331 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/n_local/evolved_operator_ansatz.py | 177,178 | 29,227 | _evolve_operator | EvolvedOperatorAnsatz | 178,199 | 178,199 | class EvolvedOperatorAnsatz(NLocal):
"""The evolved operator ansatz."""
def __init__(
self,
operators=None,
reps: int = 1,
evolution=None,
insert_barriers: bool = False,
name: str = "EvolvedOps",
parameter_prefix: str | Sequence[str] = "t",
initia... | class EvolvedOperatorAnsatz(NLocal):
"""The evolved operator ansatz."""
def __init__(
self,
operators=None,
reps: int = 1,
evolution=None,
insert_barriers: bool = False,
name: str = "EvolvedOps",
parameter_prefix: str | Sequence[str] = "t",
initia... |
# pylint: disable=cyclic-import
from qiskit.circuit.library.hamiltonian_gate import HamiltonianGate
# if the operator is specified as matrix use exact matrix exponentiation
if isinstance(operator, Operator):
gate = HamiltonianGate(operator, time)
# otherwise, use th... |
# pylint: disable=cyclic-import
from qiskit.circuit.library.hamiltonian_gate import HamiltonianGate
# if the operator is specified as matrix use exact matrix exponentiation
if isinstance(operator, Operator):
gate = HamiltonianGate(operator, time)
# otherwise, use th... | 64 | 1,643 | 242 | 1,885 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... |
30,333 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/n_local/pauli_two_design.py | 115,116 | 24,142 | _build_rotation_layer | PauliTwoDesign | 117,134 | 116,134 | class PauliTwoDesign(TwoLocal):
r"""The Pauli Two-Design ansatz.
This class implements a particular form of a 2-design circuit [1], which is frequently studied
in quantum machine learning literature, such as e.g. the investigating of Barren plateaus in
variational algorithms [2].
The circuit consi... | class PauliTwoDesign(TwoLocal):
r"""The Pauli Two-Design ansatz.
This class implements a particular form of a 2-design circuit [1], which is frequently studied
in quantum machine learning literature, such as e.g. the investigating of Barren plateaus in
variational algorithms [2].
The circuit consi... | layer = QuantumCircuit(*self.qregs)
qubits = range(self.num_qubits)
# if no gates for this layer were generated, generate them
if i not in self._gates.keys():
self._gates[i] = list(self._rng.choice(["rx", "ry", "rz"], self.num_qubits))
# if not enough gates exist, ad... | """Build a rotation layer."""
layer = QuantumCircuit(*self.qregs)
qubits = range(self.num_qubits)
# if no gates for this layer were generated, generate them
if i not in self._gates.keys():
self._gates[i] = list(self._rng.choice(["rx", "ry", "rz"], self.num_qubits))
... | 67 | 1,462 | 257 | 1,719 | # 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 derivat... | # 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 derivat... |
30,337 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/overlap.py | 101,102 | 1,112 | _check_unitary | 103,112 | 102,112 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... |
for instruction in circuit.data:
if not isinstance(instruction.operation, (Gate, Barrier)):
raise CircuitError(
(
"One or more instructions cannot be converted to"
' a gate. "{}" is not a gate instruction'
).format(instruct... | """Check a circuit is unitary by checking if all operations are of type ``Gate``."""
for instruction in circuit.data:
if not isinstance(instruction.operation, (Gate, Barrier)):
raise CircuitError(
(
"One or more instructions cannot be converted to"
... | 31 | 1,205 | 90 | 1,295 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... | |
30,338 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/pauli_evolution.py | 174,175 | 1,185 | _get_default_label | 175,185 | 175,185 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | if isinstance(operator, list):
label = f"exp(-it ({[' + '.join(op.paulis.to_labels()) for op in operator]}))"
else:
if len(operator.paulis) == 1:
label = f"exp(-it {operator.paulis.to_labels()[0]})"
# for just a single Pauli don't add brackets around the sum
else:
... | if isinstance(operator, list):
label = f"exp(-it ({[' + '.join(op.paulis.to_labels()) for op in operator]}))"
else:
if len(operator.paulis) == 1:
label = f"exp(-it {operator.paulis.to_labels()[0]})"
# for just a single Pauli don't add brackets around the sum
else:
... | 43 | 1,763 | 150 | 1,913 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | |
30,339 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/pauli_evolution.py | 146,149 | 28,156 | validate_parameter | PauliEvolutionGate | 150,156 | 149,156 | class PauliEvolutionGate(Gate):
r"""Time-evolution of an operator consisting of Paulis.
For an operator :math:`H` consisting of Pauli terms and (real) evolution time :math:`t`
this gate implements
.. math::
U(t) = e^{-itH}.
This gate serves as a high-level definition of the evolution and... | class PauliEvolutionGate(Gate):
r"""Time-evolution of an operator consisting of Paulis.
For an operator :math:`H` consisting of Pauli terms and (real) evolution time :math:`t`
this gate implements
.. math::
U(t) = e^{-itH}.
This gate serves as a high-level definition of the evolution and... | if isinstance(parameter, int):
parameter = float(parameter)
return super().validate_parameter(parameter)
| """Gate parameters should be int, float, or ParameterExpression"""
if isinstance(parameter, int):
parameter = float(parameter)
return super().validate_parameter(parameter)
| 8 | 1,263 | 38 | 1,301 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2024.
#
# 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 derivat... |
30,340 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/phase_oracle.py | 105,107 | 28,154 | from_dimacs_file | PhaseOracle | 107,154 | 107,154 | @_optionals.HAS_TWEEDLEDUM.require_in_instance
class PhaseOracle(QuantumCircuit):
r"""Phase Oracle.
The Phase Oracle object constructs circuits for any arbitrary
input logical expressions. A logical expression is composed of logical operators
`&` (`AND`), `|` (`OR`), `~` (`NOT`), and `^` (`XOR`).
a... | @_optionals.HAS_TWEEDLEDUM.require_in_instance
class PhaseOracle(QuantumCircuit):
r"""Phase Oracle.
The Phase Oracle object constructs circuits for any arbitrary
input logical expressions. A logical expression is composed of logical operators
`&` (`AND`), `|` (`OR`), `~` (`NOT`), and `^` (`XOR`).
a... | r"""Create a PhaseOracle from the string in the DIMACS format.
It is possible to build a PhaseOracle from a file in `DIMACS CNF format
<http://www.satcompetition.org/2009/format-benchmarks2009.html>`__,
which is the standard format for specifying SATisfiability (SAT) problem instances i... | r"""Create a PhaseOracle from the string in the DIMACS format.
It is possible to build a PhaseOracle from a file in `DIMACS CNF format
<http://www.satcompetition.org/2009/format-benchmarks2009.html>`__,
which is the standard format for specifying SATisfiability (SAT) problem instances i... | 282 | 1,015 | 737 | 1,752 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 wo... |
30,341 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/dcx.py | 57,58 | 20,75 | _define | DCXGate | 61,73 | 58,73 | @with_gate_array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0]])
class DCXGate(SingletonGate):
r"""Double-CNOT gate.
A 2-qubit Clifford gate consisting of two back-to-back
CNOTs with alternate controls.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.c... | @with_gate_array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0]])
class DCXGate(SingletonGate):
r"""Double-CNOT gate.
A 2-qubit Clifford gate consisting of two back-to-back
CNOTs with alternate controls.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.c... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(CXGate(), [q[0], q[1]], []), (CXGate(), [q[1], q[0]], [])]
for instr, qargs... | """
gate dcx a, b { cx a, b; cx b, a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(CXGate(), [q[0]... | 41 | 511 | 168 | 679 | # 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 derivat... | # 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 derivat... |
30,342 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/ecr.py | 93,94 | 24,128 | _define | ECRGate | 97,112 | 94,112 | @with_gate_array(
sqrt(0.5) * np.array([[0, 1, 0, 1.0j], [1, 0, -1.0j, 0], [0, 1.0j, 0, 1], [-1.0j, 0, 1, 0]])
)
class ECRGate(SingletonGate):
r"""An echoed cross-resonance gate.
This gate is maximally entangling and is equivalent to a CNOT up to
single-qubit pre-rotations. The echoing procedure mitiga... | @with_gate_array(
sqrt(0.5) * np.array([[0, 1, 0, 1.0j], [1, 0, -1.0j, 0], [0, 1.0j, 0, 1], [-1.0j, 0, 1, 0]])
)
class ECRGate(SingletonGate):
r"""An echoed cross-resonance gate.
This gate is maximally entangling and is equivalent to a CNOT up to
single-qubit pre-rotations. The echoing procedure mitiga... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
(RZXGate(np.pi / 4), [q[0], q[1]], []),
(XGate(), [q[0]], []),
(RZXGate(-np.p... | """
gate ecr a, b { rzx(pi/4) a, b; x a; rzx(-pi/4) a, b;}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
(RZXGate(np.pi... | 46 | 1,122 | 198 | 1,320 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# 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 derivat... |
30,344 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/global_phase.py | 55,56 | 25,83 | inverse | GlobalPhaseGate | 56,72 | 56,72 | class GlobalPhaseGate(Gate):
r"""The global phase gate (:math:`e^{i\theta}`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
**Mathematical Representation:**
.. math::
\text{GlobalPhaseGate}\ =
\begin{pmatrix}
e^{i\theta}
\end{pmatrix}
... | class GlobalPhaseGate(Gate):
r"""The global phase gate (:math:`e^{i\theta}`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
**Mathematical Representation:**
.. math::
\text{GlobalPhaseGate}\ =
\begin{pmatrix}
e^{i\theta}
\end{pmatrix}
... | r"""Return inverse GlobalPhaseGate gate.
:math:`\text{GlobalPhaseGate}(\lambda)^{\dagger} = \text{GlobalPhaseGate}(-\lambda)`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead... | r"""Return inverse GlobalPhaseGate gate.
:math:`\text{GlobalPhaseGate}(\lambda)^{\dagger} = \text{GlobalPhaseGate}(-\lambda)`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead... | 58 | 441 | 195 | 636 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2023.
#
# 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 wo... |
30,345 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/h.py | 210,211 | 127,250 | _define | CHGate | 222,244 | 211,244 | @with_controlled_gate_array(_H_ARRAY, num_ctrl_qubits=1)
class CHGate(SingletonControlledGate):
r"""Controlled-Hadamard gate.
Applies a Hadamard on the target qubit if the control is
in the :math:`|1\rangle` state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit... | @with_controlled_gate_array(_H_ARRAY, num_ctrl_qubits=1)
class CHGate(SingletonControlledGate):
r"""Controlled-Hadamard gate.
Applies a Hadamard on the target qubit if the control is
in the :math:`|1\rangle` state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate # pylint: disable=cyclic-import
from .t import TGate, TdgGate
from .s import SGate, SdgGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=sel... | """
gate ch a,b {
s b;
h b;
t b;
cx a, b;
tdg b;
h b;
sdg b;
}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate #... | 70 | 976 | 301 | 1,277 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,346 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/h.py | 109,110 | 24,127 | inverse | HGate | 110,123 | 110,123 | @with_gate_array(_H_ARRAY)
class HGate(SingletonGate):
r"""Single-qubit Hadamard gate.
This gate is a \pi rotation about the X+Z axis, and has the effect of
changing computation basis from :math:`|0\rangle,|1\rangle` to
:math:`|+\rangle,|-\rangle` and vice-versa.
Can be applied to a :class:`~qiski... | @with_gate_array(_H_ARRAY)
class HGate(SingletonGate):
r"""Single-qubit Hadamard gate.
This gate is a \pi rotation about the X+Z axis, and has the effect of
changing computation basis from :math:`|0\rangle,|1\rangle` to
:math:`|+\rangle,|-\rangle` and vice-versa.
Can be applied to a :class:`~qiski... | r"""Return inverted H gate (itself).
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this class this argument is ignored as... | r"""Return inverted H gate (itself).
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this class this argument is ignored as... | 52 | 884 | 140 | 1,024 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,347 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/i.py | 54,55 | 20,73 | inverse | IGate | 66,68 | 55,68 | @with_gate_array([[1, 0], [0, 1]])
class IGate(SingletonGate):
r"""Identity gate.
Identity gate corresponds to a single-qubit gate wait cycle,
and should not be optimized or unrolled (it is an opaque gate).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit... | @with_gate_array([[1, 0], [0, 1]])
class IGate(SingletonGate):
r"""Identity gate.
Identity gate corresponds to a single-qubit gate wait cycle,
and should not be optimized or unrolled (it is an opaque gate).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit... | return IGate() # self-inverse
| """Returne the inverse gate (itself).
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this class this argument is ignored a... | 4 | 514 | 16 | 530 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,348 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/iswap.py | 94,95 | 26,132 | _define | iSwapGate | 105,127 | 95,127 | @with_gate_array([[1, 0, 0, 0], [0, 0, 1j, 0], [0, 1j, 0, 0], [0, 0, 0, 1]])
class iSwapGate(SingletonGate):
r"""iSWAP gate.
A 2-qubit XX+YY interaction.
This is a Clifford and symmetric gate. Its action is to swap two qubit
states and phase the :math:`|01\rangle` and :math:`|10\rangle`
amplitudes ... | @with_gate_array([[1, 0, 0, 0], [0, 0, 1j, 0], [0, 1j, 0, 0], [0, 0, 0, 1]])
class iSwapGate(SingletonGate):
r"""iSWAP gate.
A 2-qubit XX+YY interaction.
This is a Clifford and symmetric gate. Its action is to swap two qubit
states and phase the :math:`|01\rangle` and :math:`|10\rangle`
amplitudes ... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .s import SGate
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
(SGate(), [q... | """
gate iswap a,b {
s q[0];
s q[1];
h q[0];
cx q[0],q[1];
cx q[1],q[0];
h q[1];
}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import ... | 63 | 936 | 263 | 1,199 | # 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 derivat... | # 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 derivat... |
30,350 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/p.py | 248,255 | 160,305 | control | CPhaseGate | 268,280 | 255,280 | class CPhaseGate(ControlledGate):
r"""Controlled-Phase gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cp` m... | class CPhaseGate(ControlledGate):
r"""Controlled-Phase gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cp` m... | if not annotated and ctrl_state is None:
gate = MCPhaseGate(self.params[0], num_ctrl_qubits=num_ctrl_qubits + 1, label=label)
gate.base_gate.label = self.label
else:
gate = super().control(
num_ctrl_qubits=num_ctrl_qubits,
label=label,
... | """Controlled version of this gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s... | 28 | 1,494 | 137 | 1,631 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,351 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/p.py | 357,358 | 305,428 | _define | MCPhaseGate | 358,389 | 358,389 | class MCPhaseGate(ControlledGate):
r"""Multi-controlled-Phase gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit... | class MCPhaseGate(ControlledGate):
r"""Multi-controlled-Phase gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
qr = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(qr, name=self.name)
if self.num_ctrl_qubits == 0:
qc.p(self.params[0], 0)
if self.num_ctrl_qubits == 1:
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
qr = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(qr, name=self.name)
if self.num_ctrl_qubits == 0:
qc.p(self.params[0], 0)
if self.num_ctrl_qubits == 1:
... | 103 | 877 | 468 | 1,345 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,352 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/p.py | 94,101 | 24,160 | control | PhaseGate | 114,129 | 101,129 | class PhaseGate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.p` ... | class PhaseGate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.p` ... | if not annotated and num_ctrl_qubits == 1:
gate = CPhaseGate(self.params[0], label=label, ctrl_state=ctrl_state)
gate.base_gate.label = self.label
elif not annotated and ctrl_state is None and num_ctrl_qubits > 1:
gate = MCPhaseGate(self.params[0], num_ctrl_qubits, la... | """Return a (multi-)controlled-Phase gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g. ``'110'``), or ``None``. If ``None``, us... | 45 | 1,167 | 198 | 1,365 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,353 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/r.py | 64,65 | 25,115 | _define | RGate | 68,82 | 65,82 | class RGate(Gate):
r"""Rotation θ around the cos(φ)x + sin(φ)y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.r` method.
**Circuit symbol:**
.. parsed-literal::
┌──────┐
q_0: ┤ R(ϴ) ├
└──────┘
... | class RGate(Gate):
r"""Rotation θ around the cos(φ)x + sin(φ)y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.r` method.
**Circuit symbol:**
.. parsed-literal::
┌──────┐
q_0: ┤ R(ϴ) ├
└──────┘
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u3 import U3Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
theta = self.params[0]
phi = self.params[1]
rules = [(U3Gate(theta, phi - pi... | """
gate r(θ, φ) a {u3(θ, φ - π/2, -φ + π/2) a;}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u3 import U3Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
theta = self.pa... | 52 | 901 | 189 | 1,090 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019
#
# 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 derivati... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019
#
# 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 derivati... |
30,354 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rx.py | 220,221 | 141,288 | _define | CRXGate | 230,254 | 221,254 | class CRXGate(ControlledGate):
r"""Controlled-RX gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crx` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
┌───┴───┐
q_1: ┤ Rx(ϴ) ├
... | class CRXGate(ControlledGate):
r"""Controlled-RX gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crx` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
┌───┴───┐
q_1: ┤ Rx(ϴ) ├
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
from .u3 import U3Gate
from .x import CXGate
# q_0: ─────────────■───────────────────■────────────────────
# ┌─────────┐┌─┴─┐┌─────────────┐┌─┴─┐┌... | """
gate cu3(theta,phi,lambda) c, t
{ u1(pi/2) t;
cx c,t;
u3(-theta/2,0,0) t;
cx c,t;
u3(theta/2,-pi/2,0) t;
}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 imp... | 92 | 1,377 | 466 | 1,843 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,355 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rx.py | 107,108 | 26,141 | inverse | RXGate | 108,123 | 108,123 | class RXGate(Gate):
r"""Single-qubit rotation about the X axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rx` method.
**Circuit symbol:**
.. parsed-literal::
┌───────┐
q_0: ┤ Rx(ϴ) ├
└───────┘
... | class RXGate(Gate):
r"""Single-qubit rotation about the X axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rx` method.
**Circuit symbol:**
.. parsed-literal::
┌───────┐
q_0: ┤ Rx(ϴ) ├
└───────┘
... | r"""Return inverted RX gate.
:math:`RX(\lambda)^{\dagger} = RX(-\lambda)`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. Howev... | r"""Return inverted RX gate.
:math:`RX(\lambda)^{\dagger} = RX(-\lambda)`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. Howev... | 61 | 1,062 | 173 | 1,235 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,356 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rxx.py | 81,82 | 22,145 | _define | RXXGate | 83,111 | 82,111 | class RXXGate(Gate):
r"""A parametric 2-qubit :math:`X \otimes X` interaction (rotation about XX).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rxx` method.
... | class RXXGate(Gate):
r"""A parametric 2-qubit :math:`X \otimes X` interaction (rotation about XX).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rxx` method.
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .h import HGate
from .rz import RZGate
# ┌───┐ ┌───┐
# q_0: ┤ H ├──■─────────────■──┤ H ├
# ├───┤┌─┴─┐┌───────┐... | """Calculate a subcircuit that implements this unitary."""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .h import HGate
from .rz import RZGate
# ┌───┐ ┌───┐
# q_... | 96 | 1,092 | 453 | 1,545 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# 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 derivat... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# 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 derivat... |
30,357 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/ry.py | 249,250 | 140,283 | inverse | CRYGate | 261,263 | 250,263 | class CRYGate(ControlledGate):
r"""Controlled-RY gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cry` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
┌───┴───┐
q_1: ┤ Ry(ϴ) ├
... | class CRYGate(ControlledGate):
r"""Controlled-RY gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cry` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
┌───┴───┐
q_1: ┤ Ry(ϴ) ├
... | return CRYGate(-self.params[0], ctrl_state=self.ctrl_state)
| """Return inverse CRY gate (i.e. with the negative rotation angle)
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this cla... | 3 | 1,666 | 28 | 1,694 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,358 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/ry.py | 58,59 | 25,140 | _define | RYGate | 62,74 | 59,74 | class RYGate(Gate):
r"""Single-qubit rotation about the Y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ry` method.
**Circuit symbol:**
.. parsed-literal::
┌───────┐
q_0: ┤ Ry(ϴ) ├
└───────┘
... | class RYGate(Gate):
r"""Single-qubit rotation about the Y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ry` method.
**Circuit symbol:**
.. parsed-literal::
┌───────┐
q_0: ┤ Ry(ϴ) ├
└───────┘
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .r import RGate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(RGate(self.params[0], pi / 2), [q[0]], [])]
for instr, qargs, cargs in rules... | """
gate ry(theta) a { r(theta, pi/2) a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .r import RGate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(RGate(self.pa... | 39 | 1,078 | 155 | 1,233 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,359 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/ryy.py | 81,82 | 22,145 | _define | RYYGate | 83,111 | 82,111 | class RYYGate(Gate):
r"""A parametric 2-qubit :math:`Y \otimes Y` interaction (rotation about YY).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ryy` method.
... | class RYYGate(Gate):
r"""A parametric 2-qubit :math:`Y \otimes Y` interaction (rotation about YY).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ryy` method.
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .rx import RXGate
from .rz import RZGate
# ┌─────────┐ ┌──────────┐
# q_0: ┤ Rx(π/2) ├──■─────────────■──┤ Rx(-π/2) ├
... | """Calculate a subcircuit that implements this unitary."""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .rx import RXGate
from .rz import RZGate
# ┌─────────┐ ┌─────────... | 104 | 1,077 | 515 | 1,592 | # 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 derivat... | # 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 derivat... |
30,360 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rz.py | 239,240 | 152,303 | _define | CRZGate | 246,267 | 240,267 | class CRZGate(ControlledGate):
r"""Controlled-RZ gate.
This is a diagonal but non-symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crz` me... | class CRZGate(ControlledGate):
r"""Controlled-RZ gate.
This is a diagonal but non-symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crz` me... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
# q_0: ─────────────■────────────────■──
# ┌─────────┐┌─┴─┐┌──────────┐┌─┴─┐
# q_1: ┤ Rz(λ/2) ├┤ X ├┤ Rz(-λ/2) ├┤ X ├
# └─────────┘└───┘└─────... | """
gate crz(lambda) a,b
{ rz(lambda/2) b; cx a,b;
rz(-lambda/2) b; cx a,b;
}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
# q_0: ─────────────■────────────────■──
... | 71 | 1,381 | 360 | 1,741 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,361 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rz.py | 68,69 | 22,152 | _define | RZGate | 72,85 | 69,85 | class RZGate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rz` me... | class RZGate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rz` me... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
theta = self.params[0]
qc = QuantumCircuit(q, name=self.name, global_phase=-theta / 2)
rules = [(U1Gate(theta), [q[0]], [])... | """
gate rz(phi) a { u1(phi) a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
theta = self.params[0]
qc = QuantumCircuit(q, name=self.name, global_... | 42 | 1,199 | 171 | 1,370 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,362 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rzx.py | 126,127 | 21,191 | _define | RZXGate | 130,155 | 127,155 | class RZXGate(Gate):
r"""A parametric 2-qubit :math:`Z \otimes X` interaction (rotation about ZX).
This gate is maximally entangling at :math:`\theta = \pi/2`.
The cross-resonance gate (CR) for superconducting qubits implements
a ZX interaction (however other terms are also present in an experiment).
... | class RZXGate(Gate):
r"""A parametric 2-qubit :math:`Z \otimes X` interaction (rotation about ZX).
This gate is maximally entangling at :math:`\theta = \pi/2`.
The cross-resonance gate (CR) for superconducting qubits implements
a ZX interaction (however other terms are also present in an experiment).
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CXGate
from .rz import RZGate
# q_0: ───────■─────────────■───────
# ┌───┐┌─┴─┐┌───────┐┌─┴─┐┌───┐
# q_1: ┤ H ├┤ X ├┤ Rz(0) ├... | """
gate rzx(theta) a, b { h b; cx a, b; u1(theta) b; cx a, b; h b;}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CXGate
from .rz import RZGate
# q_0: ───────■────... | 83 | 1,637 | 399 | 2,036 | # 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 derivat... | # 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 derivat... |
30,363 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/rzz.py | 93,94 | 21,158 | _define | RZZGate | 97,119 | 94,119 | class RZZGate(Gate):
r"""A parametric 2-qubit :math:`Z \otimes Z` interaction (rotation about ZZ).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rzz` method.
... | class RZZGate(Gate):
r"""A parametric 2-qubit :math:`Z \otimes Z` interaction (rotation about ZZ).
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rzz` method.
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .rz import RZGate
# q_0: ──■─────────────■──
# ┌─┴─┐┌───────┐┌─┴─┐
# q_1: ┤ X ├┤ Rz(0) ├┤ X ├
# └───┘└───────┘└───┘
q = Q... | """
gate rzz(theta) a, b { cx a, b; u1(theta) b; cx a, b; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
from .rz import RZGate
# q_0: ──■─────────────■──
# ┌─┴─┐┌───────┐┌... | 69 | 1,158 | 319 | 1,477 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,364 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/s.py | 238,239 | 183,269 | _define | CSGate | 242,246 | 239,246 | @with_controlled_gate_array(_S_ARRAY, num_ctrl_qubits=1)
class CSGate(SingletonControlledGate):
r"""Controlled-S gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cs` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ──■──... | @with_controlled_gate_array(_S_ARRAY, num_ctrl_qubits=1)
class CSGate(SingletonControlledGate):
r"""Controlled-S gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cs` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ──■──... | from .p import CPhaseGate
self.definition = CPhaseGate(theta=pi / 2).definition
| """
gate cs a,b { h b; cp(pi/2) a,b; h b; }
"""
from .p import CPhaseGate
self.definition = CPhaseGate(theta=pi / 2).definition
| 9 | 785 | 37 | 822 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,365 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/s.py | 323,324 | 269,352 | _define | CSdgGate | 327,331 | 324,331 | @with_controlled_gate_array(_SDG_ARRAY, num_ctrl_qubits=1)
class CSdgGate(SingletonControlledGate):
r"""Controlled-S^\dagger gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.csdg` method.
**Circuit symbol:**
.. parsed-literal::
... | @with_controlled_gate_array(_SDG_ARRAY, num_ctrl_qubits=1)
class CSdgGate(SingletonControlledGate):
r"""Controlled-S^\dagger gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.csdg` method.
**Circuit symbol:**
.. parsed-literal::
... | from .p import CPhaseGate
self.definition = CPhaseGate(theta=-pi / 2).definition
| """
gate csdg a,b { h b; cp(-pi/2) a,b; h b; }
"""
from .p import CPhaseGate
self.definition = CPhaseGate(theta=-pi / 2).definition
| 9 | 795 | 38 | 833 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,366 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/s.py | 97,98 | 29,106 | power | SGate | 98,102 | 98,102 | @with_gate_array(_S_ARRAY)
class SGate(SingletonGate):
r"""Single qubit S gate (Z**0.5).
It induces a :math:`\pi/2` phase, and is sometimes called the P gate (phase).
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`... | @with_gate_array(_S_ARRAY)
class SGate(SingletonGate):
r"""Single qubit S gate (Z**0.5).
It induces a :math:`\pi/2` phase, and is sometimes called the P gate (phase).
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`... | from .p import PhaseGate
return PhaseGate(0.5 * numpy.pi * exponent)
| from .p import PhaseGate
return PhaseGate(0.5 * numpy.pi * exponent)
| 10 | 720 | 35 | 755 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,367 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/s.py | 143,144 | 106,183 | _define | SdgGate | 147,160 | 144,160 | @with_gate_array(_SDG_ARRAY)
class SdgGate(SingletonGate):
r"""Single qubit S-adjoint gate (~Z**0.5).
It induces a :math:`-\pi/2` phase.
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit... | @with_gate_array(_SDG_ARRAY)
class SdgGate(SingletonGate):
r"""Single qubit S-adjoint gate (~Z**0.5).
It induces a :math:`-\pi/2` phase.
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(-pi / 2), [q[0]], [])]
for instr, qargs, cargs in rules:
... | """
gate sdg a { u1(-pi/2) a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(-pi / 2), [q[0... | 38 | 616 | 154 | 770 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,368 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/swap.py | 242,243 | 138,282 | _define | CSwapGate | 250,266 | 243,266 | @with_controlled_gate_array(_SWAP_ARRAY, num_ctrl_qubits=1)
class CSwapGate(SingletonControlledGate):
r"""Controlled-SWAP gate, also known as the Fredkin gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cswap` and
:meth:`~qiskit.circuit.Qu... | @with_controlled_gate_array(_SWAP_ARRAY, num_ctrl_qubits=1)
class CSwapGate(SingletonControlledGate):
r"""Controlled-SWAP gate, also known as the Fredkin gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cswap` and
:meth:`~qiskit.circuit.Qu... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate, CCXGate
q = QuantumRegister(3, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
(CXGate(), [q[2], q[1]], []),
(CCXGate(), [q[0], q... | """
gate cswap a,b,c
{ cx c,b;
ccx a,b,c;
cx c,b;
}
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate, CCXGate
q = QuantumRegister(3, "q")
qc = QuantumCir... | 49 | 1,425 | 207 | 1,632 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,369 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/swap.py | 67,68 | 25,138 | _define | SwapGate | 71,87 | 68,87 | @with_gate_array(_SWAP_ARRAY)
class SwapGate(SingletonGate):
r"""The SWAP gate.
This is a symmetric and Clifford gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.swap` method.
**Circuit symbol:**
.. parsed-literal::
q_0... | @with_gate_array(_SWAP_ARRAY)
class SwapGate(SingletonGate):
r"""The SWAP gate.
This is a symmetric and Clifford gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.swap` method.
**Circuit symbol:**
.. parsed-literal::
q_0... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
(CXGate(), [q[0], q[1]], []),
(CXGate(), [q[1], q[0]], []),... | """
gate swap a,b { cx a,b; cx b,a; cx a,b; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [
... | 47 | 906 | 198 | 1,104 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,370 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/sx.py | 288,289 | 207,306 | _define | CSXGate | 292,304 | 289,304 | @with_controlled_gate_array(_SX_ARRAY, num_ctrl_qubits=1)
class CSXGate(SingletonControlledGate):
r"""Controlled-√X gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.csx` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ─... | @with_controlled_gate_array(_SX_ARRAY, num_ctrl_qubits=1)
class CSXGate(SingletonControlledGate):
r"""Controlled-√X gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.csx` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ─... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .u1 import CU1Gate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(HGate(), [q[1]], []), (CU1Gate(pi / 2), [q[0], q[1]]... | """
gate csx a,b { h b; cu1(pi/2) a,b; h b; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .u1 import CU1Gate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.na... | 49 | 879 | 190 | 1,069 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,371 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/sx.py | 101,108 | 26,138 | control | SXGate | 123,134 | 108,134 | @with_gate_array(_SX_ARRAY)
class SXGate(SingletonGate):
r"""The single-qubit Sqrt(X) gate (:math:`\sqrt{X}`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sx` method.
**Matrix Representation:**
.. math::
\sqrt{X} = \frac{1}{2... | @with_gate_array(_SX_ARRAY)
class SXGate(SingletonGate):
r"""The single-qubit Sqrt(X) gate (:math:`\sqrt{X}`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sx` method.
**Matrix Representation:**
.. math::
\sqrt{X} = \frac{1}{2... | if not annotated and num_ctrl_qubits == 1:
gate = CSXGate(label=label, ctrl_state=ctrl_state, _base_label=self.label)
else:
gate = super().control(
num_ctrl_qubits=num_ctrl_qubits,
label=label,
ctrl_state=ctrl_state,
... | """Return a (multi-)controlled-SX gate.
One control returns a CSX gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'... | 23 | 1,059 | 120 | 1,179 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,372 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/sx.py | 173,174 | 138,207 | _define | SXdgGate | 177,189 | 174,189 | @with_gate_array(_SXDG_ARRAY)
class SXdgGate(SingletonGate):
r"""The inverse single-qubit Sqrt(X) gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sxdg` method.
.. math::
\sqrt{X}^{\dagger} = \frac{1}{2} \begin{pmatrix}
... | @with_gate_array(_SXDG_ARRAY)
class SXdgGate(SingletonGate):
r"""The inverse single-qubit Sqrt(X) gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sxdg` method.
.. math::
\sqrt{X}^{\dagger} = \frac{1}{2} \begin{pmatrix}
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .s import SGate
from .h import HGate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name, global_phase=-pi / 4)
rules = [(SGate(), [q[0]], []), (HGate(), [... | """
gate sxdg a { rz(pi/2) a; h a; rz(pi/2); }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .s import SGate
from .h import HGate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name... | 49 | 610 | 187 | 797 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,373 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/t.py | 64,65 | 26,102 | _define | TGate | 68,81 | 65,81 | @with_gate_array([[1, 0], [0, (1 + 1j) / math.sqrt(2)]])
class TGate(SingletonGate):
r"""Single qubit T gate (Z**0.25).
It induces a :math:`\pi/4` phase, and is sometimes called the pi/8 gate
(because of how the RZ(\pi/4) matrix looks like).
This is a non-Clifford gate and a fourth-root of Pauli-Z.
... | @with_gate_array([[1, 0], [0, (1 + 1j) / math.sqrt(2)]])
class TGate(SingletonGate):
r"""Single qubit T gate (Z**0.25).
It induces a :math:`\pi/4` phase, and is sometimes called the pi/8 gate
(because of how the RZ(\pi/4) matrix looks like).
This is a non-Clifford gate and a fourth-root of Pauli-Z.
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(pi / 4), [q[0]], [])]
for instr, qargs, cargs in rules:
... | """
gate t a { u1(pi/4) a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(pi / 4), [q[0]], ... | 38 | 648 | 154 | 802 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,374 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/t.py | 139,140 | 102,175 | _define | TdgGate | 143,156 | 140,156 | @with_gate_array([[1, 0], [0, (1 - 1j) / math.sqrt(2)]])
class TdgGate(SingletonGate):
r"""Single qubit T-adjoint gate (~Z**0.25).
It induces a :math:`-\pi/4` phase.
This is a non-Clifford gate and a fourth-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :met... | @with_gate_array([[1, 0], [0, (1 - 1j) / math.sqrt(2)]])
class TdgGate(SingletonGate):
r"""Single qubit T-adjoint gate (~Z**0.25).
It induces a :math:`-\pi/4` phase.
This is a non-Clifford gate and a fourth-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :met... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(-pi / 4), [q[0]], [])]
for instr, qargs, cargs in rules:
... | """
gate tdg a { u1(pi/4) a; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u1 import U1Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U1Gate(-pi / 4), [q[0]... | 38 | 633 | 154 | 787 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,376 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u.py | 100,107 | 26,160 | control | UGate | 120,139 | 107,139 | class UGate(Gate):
r"""Generic single-qubit rotation gate with 3 Euler angles.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.u` method.
**Circuit symbol:**
.. parsed-literal::
┌──────────┐
q_0: ┤ U(ϴ,φ,λ) ├
... | class UGate(Gate):
r"""Generic single-qubit rotation gate with 3 Euler angles.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.u` method.
**Circuit symbol:**
.. parsed-literal::
┌──────────┐
q_0: ┤ U(ϴ,φ,λ) ├
... | if not annotated and num_ctrl_qubits == 1:
gate = CUGate(
self.params[0],
self.params[1],
self.params[2],
0,
label=label,
ctrl_state=ctrl_state,
)
gate.base_gate.label = self.label... | """Return a (multi-)controlled-U gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'110'``), or ``None``. If ``None``, use all... | 31 | 1,209 | 166 | 1,375 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,377 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u1.py | 262,269 | 171,324 | control | CU1Gate | 282,294 | 269,294 | class CU1Gate(ControlledGate):
r"""Controlled-U1 gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
**Circuit symbol:**
.. parsed-literal::
q_0: ─■──
│λ
q_1: ─■──
**Matrix represe... | class CU1Gate(ControlledGate):
r"""Controlled-U1 gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
**Circuit symbol:**
.. parsed-literal::
q_0: ─■──
│λ
q_1: ─■──
**Matrix represe... | if not annotated and ctrl_state is None:
gate = MCU1Gate(self.params[0], num_ctrl_qubits=num_ctrl_qubits + 1, label=label)
gate.base_gate.label = self.label
else:
gate = super().control(
num_ctrl_qubits=num_ctrl_qubits,
label=label,
... | """Controlled version of this gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s... | 28 | 1,569 | 136 | 1,705 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,378 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u1.py | 373,374 | 324,447 | _define | MCU1Gate | 374,394 | 374,394 | class MCU1Gate(ControlledGate):
r"""Multi-controlled-U1 gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
│
... | class MCU1Gate(ControlledGate):
r"""Multi-controlled-U1 gate.
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
**Circuit symbol:**
.. parsed-literal::
q_0: ────■────
│
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
if self.num_ctrl_qubits == 0:
definition = U1Gate(self.params[0]).definition
if self.num... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
q = QuantumRegister(self.num_qubits, "q")
qc = QuantumCircuit(q, name=self.name)
if self.num_ctrl_qubits == 0:
definition = U1Gate(self.params[0]).definition
if self.num... | 63 | 993 | 280 | 1,273 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,379 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u1.py | 149,150 | 24,171 | inverse | U1Gate | 150,163 | 150,163 | class U1Gate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
... | class U1Gate(Gate):
r"""Single-qubit rotation about the Z axis.
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
... | r"""Return inverted U1 gate (:math:`U1(\lambda)^{\dagger} = U1(-\lambda))`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for ... | r"""Return inverted U1 gate (:math:`U1(\lambda)^{\dagger} = U1(-\lambda))`
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for ... | 60 | 1,282 | 170 | 1,452 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,380 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u2.py | 101,102 | 23,144 | _define | U2Gate | 102,114 | 102,114 | class U2Gate(Gate):
r"""Single-qubit rotation about the X+Z axis.
Implemented using one X90 pulse on IBM Quantum systems:
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
U2(\phi, \lambda) = U\left(\frac{\pi}{2}, \phi, \lambda\r... | class U2Gate(Gate):
r"""Single-qubit rotation about the X+Z axis.
Implemented using one X90 pulse on IBM Quantum systems:
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
U2(\phi, \lambda) = U\left(\frac{\pi}{2}, \phi, \lambda\r... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u3 import U3Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U3Gate(pi / 2, self.params[0], self.params[1]), [q[0]], [])]
for instr, qa... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .u3 import U3Gate
q = QuantumRegister(1, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(U3Gate(pi / 2, self.params[0], self.params[1]), [q[0]], [])]
for instr, qa... | 40 | 1,043 | 165 | 1,208 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,383 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/u3.py | 112,119 | 24,169 | control | U3Gate | 132,144 | 119,144 | class U3Gate(Gate):
r"""Generic single-qubit rotation gate with 3 Euler angles.
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
U3(\theta, \phi, \lambda) = U(\theta, \phi, \lambda)
.. code-block:: python
circuit ... | class U3Gate(Gate):
r"""Generic single-qubit rotation gate with 3 Euler angles.
.. warning::
This gate is deprecated. Instead, the following replacements should be used
.. math::
U3(\theta, \phi, \lambda) = U(\theta, \phi, \lambda)
.. code-block:: python
circuit ... | if not annotated and num_ctrl_qubits == 1:
gate = CU3Gate(*self.params, label=label, ctrl_state=ctrl_state)
gate.base_gate.label = self.label
else:
gate = super().control(
num_ctrl_qubits=num_ctrl_qubits,
label=label,
ct... | """Return a (multi-)controlled-U3 gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'110'``), or ``None``. If ``None``, use al... | 26 | 1,362 | 129 | 1,491 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,384 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/xx_minus_yy.py | 112,113 | 32,197 | _define | XXMinusYYGate | 131,156 | 113,156 | class XXMinusYYGate(Gate):
r"""XX-YY interaction gate.
A 2-qubit parameterized XX-YY interaction. Its action is to induce
a coherent rotation by some angle between :math:`|00\rangle` and :math:`|11\rangle`.
**Circuit Symbol:**
.. parsed-literal::
┌───────────────┐
q_0: ┤0 ... | class XXMinusYYGate(Gate):
r"""XX-YY interaction gate.
A 2-qubit parameterized XX-YY interaction. Its action is to induce
a coherent rotation by some angle between :math:`|00\rangle` and :math:`|11\rangle`.
**Circuit Symbol:**
.. parsed-literal::
┌───────────────┐
q_0: ┤0 ... | theta, beta = self.params
register = QuantumRegister(2, "q")
circuit = QuantumCircuit(register, name=self.name)
a, b = register
rules = [
(RZGate(-beta), [b], []),
(RZGate(-pi / 2), [a], []),
(SXGate(), [a], []),
(RZGate(pi / 2), [a... | """
gate xx_minus_yy(theta, beta) a, b {
rz(-beta) b;
rz(-pi/2) a;
sx a;
rz(pi/2) a;
s b;
cx a, b;
ry(theta/2) a;
ry(-theta/2) b;
cx a, b;
sdg b;
rz(-pi/2) a;
s... | 88 | 1,554 | 339 | 1,893 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 wo... |
30,386 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/y.py | 224,225 | 143,257 | _define | CYGate | 228,241 | 225,241 | @with_controlled_gate_array(_Y_ARRAY, num_ctrl_qubits=1)
class CYGate(SingletonControlledGate):
r"""Controlled-Y gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cy` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ──■──... | @with_controlled_gate_array(_Y_ARRAY, num_ctrl_qubits=1)
class CYGate(SingletonControlledGate):
r"""Controlled-Y gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cy` method.
**Circuit symbol:**
.. parsed-literal::
q_0: ──■──... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .s import SGate, SdgGate
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(SdgGate(), [q[1]], []), (CXGate(), [q[0], q[1... | """
gate cy a,b { sdg b; cx a,b; s b; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .s import SGate, SdgGate
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.n... | 48 | 950 | 194 | 1,144 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,387 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/y.py | 125,126 | 26,143 | inverse | YGate | 126,139 | 126,139 | @with_gate_array(_Y_ARRAY)
class YGate(SingletonGate):
r"""The single-qubit Pauli-Y gate (:math:`\sigma_y`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.y` method.
**Matrix Representation:**
.. math::
Y = \begin{pmatrix}
... | @with_gate_array(_Y_ARRAY)
class YGate(SingletonGate):
r"""The single-qubit Pauli-Y gate (:math:`\sigma_y`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.y` method.
**Matrix Representation:**
.. math::
Y = \begin{pmatrix}
... | r"""Return inverted Y gate (:math:`Y^{\dagger} = Y`)
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this class this argume... | r"""Return inverted Y gate (:math:`Y^{\dagger} = Y`)
Args:
annotated: when set to ``True``, this is typically used to return an
:class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
:class:`.Gate`. However, for this class this argume... | 54 | 960 | 150 | 1,110 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,388 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/z.py | 308,309 | 244,342 | _define | CCZGate | 312,326 | 309,326 | @with_controlled_gate_array(_Z_ARRAY, num_ctrl_qubits=2, cached_states=(3,))
class CCZGate(SingletonControlledGate):
r"""CCZ gate.
This is a symmetric gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ccz` method.
**Circuit symbol:**
... | @with_controlled_gate_array(_Z_ARRAY, num_ctrl_qubits=2, cached_states=(3,))
class CCZGate(SingletonControlledGate):
r"""CCZ gate.
This is a symmetric gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ccz` method.
**Circuit symbol:**
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CCXGate
q = QuantumRegister(3, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(HGate(), [q[2]], []), (CCXGate(), [q[0], q[1], q[2]]... | """
gate ccz a,b,c { h c; ccx a,b,c; h c; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CCXGate
q = QuantumRegister(3, "q")
qc = QuantumCircuit(q, name=self.name... | 48 | 923 | 192 | 1,115 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,389 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/z.py | 208,209 | 150,244 | _define | CZGate | 212,226 | 209,226 | @with_controlled_gate_array(_Z_ARRAY, num_ctrl_qubits=1)
class CZGate(SingletonControlledGate):
r"""Controlled-Z gate.
This is a Clifford and symmetric gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cz` method.
**Circuit symbol:**
... | @with_controlled_gate_array(_Z_ARRAY, num_ctrl_qubits=1)
class CZGate(SingletonControlledGate):
r"""Controlled-Z gate.
This is a Clifford and symmetric gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cz` method.
**Circuit symbol:**
... | # pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
rules = [(HGate(), [q[1]], []), (CXGate(), [q[0], q[1]], []), (... | """
gate cz a,b { h b; cx a,b; h b; }
"""
# pylint: disable=cyclic-import
from qiskit.circuit.quantumcircuit import QuantumCircuit
from .h import HGate
from .x import CXGate
q = QuantumRegister(2, "q")
qc = QuantumCircuit(q, name=self.name)
... | 47 | 746 | 188 | 934 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,390 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/standard_gates/z.py | 96,103 | 29,150 | control | ZGate | 118,129 | 103,129 | @with_gate_array(_Z_ARRAY)
class ZGate(SingletonGate):
r"""The single-qubit Pauli-Z gate (:math:`\sigma_z`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.z` method.
**Matrix Representation:**
.. math::
Z = \begin{pmatrix}
... | @with_gate_array(_Z_ARRAY)
class ZGate(SingletonGate):
r"""The single-qubit Pauli-Z gate (:math:`\sigma_z`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.z` method.
**Matrix Representation:**
.. math::
Z = \begin{pmatrix}
... | if not annotated and num_ctrl_qubits == 1:
gate = CZGate(label=label, ctrl_state=ctrl_state, _base_label=self.label)
else:
gate = super().control(
num_ctrl_qubits=num_ctrl_qubits,
label=label,
ctrl_state=ctrl_state,
... | """Return a (multi-)controlled-Z gate.
One control returns a CZ gate.
Args:
num_ctrl_qubits: number of control qubits.
label: An optional label for the gate [Default: ``None``]
ctrl_state: control state expressed as integer,
string (e.g.``'11... | 23 | 999 | 120 | 1,119 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 wo... |
30,391 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_2_1.py | 25,26 | 1,34 | clifford_2_1 | 30,34 | 26,34 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cz(0, 1)
qc.cz(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cz(0, 1)
qc.cz(0, 1)
return qc
| 9 | 254 | 45 | 299 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,392 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_2_2.py | 26,27 | 1,35 | clifford_2_2 | 31,35 | 27,35 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(0, 1)
return qc
| 9 | 284 | 47 | 331 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,393 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_2_3.py | 24,25 | 1,33 | clifford_2_3 | 29,33 | 25,33 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(1)
qc.h(0)
qc.h(0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(1)
qc.h(0)
qc.h(0)
return qc
| 7 | 265 | 39 | 304 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,394 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_2_4.py | 25,26 | 1,34 | clifford_2_4 | 30,34 | 26,34 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.swap(0, 1)
qc.swap(1, 0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.swap(0, 1)
qc.swap(1, 0)
return qc
| 9 | 250 | 45 | 295 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,395 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_3_1.py | 25,26 | 1,35 | clifford_3_1 | 30,35 | 26,35 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(1)
qc.s(0)
qc.s(0)
qc.z(0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(1)
qc.s(0)
qc.s(0)
qc.z(0)
return qc
| 8 | 283 | 49 | 332 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,396 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_4_1.py | 27,28 | 1,38 | clifford_4_1 | 32,38 | 28,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.swap(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.swap(0, 1)
return qc
| 13 | 319 | 74 | 393 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,397 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_4_2.py | 26,27 | 1,37 | clifford_4_2 | 31,37 | 27,37 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.h(1)
qc.cx(0, 1)
qc.h(1)
qc.cz(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.h(1)
qc.cx(0, 1)
qc.h(1)
qc.cz(0, 1)
return qc
| 11 | 308 | 66 | 374 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,398 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_4_3.py | 27,28 | 1,38 | clifford_4_3 | 32,38 | 28,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.s(0)
qc.cx(0, 1)
qc.sdg(0)
qc.cx(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.s(0)
qc.cx(0, 1)
qc.sdg(0)
qc.cx(0, 1)
return qc
| 11 | 329 | 68 | 397 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,399 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_4_4.py | 26,27 | 1,37 | clifford_4_4 | 31,37 | 27,37 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.s(0)
qc.cz(0, 1)
qc.sdg(0)
qc.cz(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.s(0)
qc.cz(0, 1)
qc.sdg(0)
qc.cz(0, 1)
return qc
| 11 | 298 | 66 | 364 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,400 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_5_1.py | 28,29 | 1,40 | clifford_5_1 | 33,40 | 29,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 2)
return qc
| 15 | 376 | 89 | 465 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,401 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_6_1.py | 27,28 | 1,40 | clifford_6_1 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.h(0)
qc.h(1)
qc.cx(0, 1)
qc.h(0)
qc.h(1)
qc.cx(1, 0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.h(0)
qc.h(1)
qc.cx(0, 1)
qc.h(0)
qc.h(1)
qc.cx(1, 0)
return qc
| 13 | 342 | 87 | 429 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,402 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_6_2.py | 27,28 | 1,40 | clifford_6_2 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.s(0)
qc.s(1)
qc.cx(0, 1)
qc.sdg(1)
qc.cx(0, 1)
qc.cz(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.s(0)
qc.s(1)
qc.cx(0, 1)
qc.sdg(1)
qc.cx(0, 1)
qc.cz(0, 1)
return qc
| 14 | 344 | 91 | 435 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,403 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_6_3.py | 27,28 | 1,40 | clifford_6_3 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.swap(0, 1)
qc.cz(0, 1)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 0)
qc.h(1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.swap(0, 1)
qc.cz(0, 1)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 0)
qc.h(1)
return qc
| 15 | 342 | 93 | 435 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,404 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_6_4.py | 25,26 | 1,38 | clifford_6_4 | 30,38 | 26,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(1)
qc.s(0)
qc.h(0)
qc.s(0)
qc.h(0)
qc.s(0)
qc.h(0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(1)
qc.s(0)
qc.h(0)
qc.s(0)
qc.h(0)
qc.s(0)
qc.h(0)
return qc
| 11 | 334 | 79 | 413 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,405 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_6_5.py | 27,28 | 1,40 | clifford_6_5 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cz(0, 1)
qc.cx(0, 1)
qc.s(0)
qc.sdg(1)
qc.cx(0, 1)
qc.s(1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cz(0, 1)
qc.cx(0, 1)
qc.s(0)
qc.sdg(1)
qc.cx(0, 1)
qc.s(1)
return qc
| 14 | 351 | 91 | 442 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,406 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_8_1.py | 27,28 | 1,42 | clifford_8_1 | 32,42 | 28,42 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.h(1)
qc.cx(1, 0)
qc.s(0)
qc.sdg(1)
qc.cx(1, 0)
qc.sdg(0)
qc.h(1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.h(1)
qc.cx(1, 0)
qc.s(0)
qc.sdg(1)
qc.cx(1, 0)
qc.sdg(0)
qc.h(1)
return qc
| 16 | 403 | 113 | 516 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,407 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_8_2.py | 27,28 | 1,42 | clifford_8_2 | 32,42 | 28,42 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.h(1)
qc.cx(0, 1)
qc.s(0)
qc.sdg(1)
qc.cx(0, 1)
qc.s(1)
qc.h(1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.h(1)
qc.cx(0, 1)
qc.s(0)
qc.sdg(1)
qc.cx(0, 1)
qc.s(1)
qc.h(1)
return qc
| 16 | 399 | 112 | 511 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,408 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/clifford/clifford_8_3.py | 26,27 | 1,41 | clifford_8_3 | 31,41 | 27,41 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.s(1)
qc.h(1)
qc.s(1)
qc.cx(0, 1)
qc.sdg(1)
qc.h(1)
qc.sdg(1)
qc.cx(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.s(1)
qc.h(1)
qc.s(1)
qc.cx(0, 1)
qc.sdg(1)
qc.h(1)
qc.sdg(1)
qc.cx(0, 1)
return qc
| 15 | 398 | 109 | 507 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,409 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_2a_1.py | 24,25 | 1,33 | template_nct_2a_1 | 29,33 | 25,33 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(1)
qc.x(0)
qc.x(0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(1)
qc.x(0)
qc.x(0)
return qc
| 7 | 265 | 39 | 304 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,410 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_2a_2.py | 25,26 | 1,34 | template_nct_2a_2 | 30,34 | 26,34 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(0, 1)
return qc
| 9 | 283 | 47 | 330 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,411 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_2a_3.py | 27,28 | 1,36 | template_nct_2a_3 | 32,36 | 28,36 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.ccx(0, 1, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.ccx(0, 1, 2)
return qc
| 11 | 302 | 53 | 355 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,412 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_4a_1.py | 31,32 | 1,42 | template_nct_4a_1 | 36,42 | 32,42 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(5)
qc.ccx(1, 2, 4)
qc.ccx(0, 2, 3)
qc.ccx(1, 2, 4)
qc.ccx(0, 2, 3)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(5)
qc.ccx(1, 2, 4)
qc.ccx(0, 2, 3)
qc.ccx(1, 2, 4)
qc.ccx(0, 2, 3)
return qc
| 17 | 406 | 87 | 493 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,413 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_4a_2.py | 29,30 | 1,40 | template_nct_4a_2 | 34,40 | 30,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(4)
qc.ccx(0, 1, 3)
qc.cx(1, 2)
qc.ccx(0, 1, 3)
qc.cx(1, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(4)
qc.ccx(0, 1, 3)
qc.cx(1, 2)
qc.ccx(0, 1, 3)
qc.cx(1, 2)
return qc
| 15 | 377 | 81 | 458 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,414 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_4a_3.py | 27,28 | 1,38 | template_nct_4a_3 | 32,38 | 28,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(0, 2)
qc.cx(0, 1)
qc.cx(0, 2)
qc.cx(0, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(0, 2)
qc.cx(0, 1)
qc.cx(0, 2)
qc.cx(0, 1)
return qc
| 13 | 354 | 75 | 429 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,415 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_4b_1.py | 29,30 | 1,40 | template_nct_4b_1 | 34,40 | 30,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(4)
qc.ccx(1, 2, 3)
qc.ccx(0, 2, 3)
qc.ccx(1, 2, 3)
qc.ccx(0, 2, 3)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(4)
qc.ccx(1, 2, 3)
qc.ccx(0, 2, 3)
qc.ccx(1, 2, 3)
qc.ccx(0, 2, 3)
return qc
| 17 | 379 | 87 | 466 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,416 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_4b_2.py | 27,28 | 1,38 | template_nct_4b_2 | 32,38 | 28,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
return qc
| 15 | 350 | 81 | 431 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,417 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_5a_1.py | 27,28 | 1,39 | template_nct_5a_1 | 32,39 | 28,39 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(0, 1)
qc.ccx(0, 1, 2)
qc.cx(0, 1)
qc.cx(0, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(0, 1)
qc.ccx(0, 1, 2)
qc.cx(0, 1)
qc.cx(0, 2)
return qc
| 17 | 383 | 95 | 478 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,418 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_5a_2.py | 27,28 | 1,39 | template_nct_5a_2 | 32,39 | 28,39 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.x(1)
qc.ccx(0, 1, 2)
qc.x(1)
qc.cx(0, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.x(1)
qc.ccx(0, 1, 2)
qc.x(1)
qc.cx(0, 2)
return qc
| 15 | 377 | 87 | 464 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,419 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_5a_3.py | 27,28 | 1,39 | template_nct_5a_3 | 32,39 | 28,39 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(0, 2)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(1, 2)
qc.cx(0, 1)
qc.cx(0, 2)
return qc
| 15 | 377 | 89 | 466 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,420 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_5a_4.py | 26,27 | 1,38 | template_nct_5a_4 | 31,38 | 27,38 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.x(0)
qc.cx(0, 1)
qc.x(0)
qc.x(1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.x(0)
qc.cx(0, 1)
qc.x(0)
qc.x(1)
return qc
| 12 | 334 | 77 | 411 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,421 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6a_1.py | 26,27 | 1,39 | template_nct_6a_1 | 31,39 | 27,39 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.cx(1, 0)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.cx(1, 0)
qc.cx(0, 1)
qc.cx(1, 0)
return qc
| 17 | 382 | 103 | 485 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,422 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6a_2.py | 27,28 | 1,40 | template_nct_6a_2 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| 23 | 420 | 121 | 541 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,423 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6a_3.py | 27,28 | 1,40 | template_nct_6a_3 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| 21 | 414 | 115 | 529 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,424 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6a_4.py | 27,28 | 1,40 | template_nct_6a_4 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
return qc
| 19 | 407 | 109 | 516 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,425 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6b_1.py | 27,28 | 1,40 | template_nct_6b_1 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
qc.ccx(0, 1, 2)
qc.cx(1, 2)
qc.ccx(0, 2, 1)
return qc
| 21 | 410 | 115 | 525 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,426 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6b_2.py | 27,28 | 1,40 | template_nct_6b_2 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
qc.cx(1, 2)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| 21 | 410 | 115 | 525 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | |
30,427 | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit | /home/hieuvd/dung_repo/raw/stars_02/Qiskit_qiskit/qiskit/qiskit/circuit/library/templates/nct/template_nct_6c_1.py | 27,28 | 1,40 | template_nct_6c_1 | 32,40 | 28,40 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| """
Returns:
QuantumCircuit: template as a quantum circuit.
"""
qc = QuantumCircuit(3)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.cx(2, 1)
qc.ccx(0, 1, 2)
qc.ccx(0, 2, 1)
return qc
| 21 | 414 | 115 | 529 | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... | # This code is part of Qiskit.
#
# (C) Copyright IBM 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 wo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.