-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop monkeypatching standard gates and move them to circuit/library/s…
…tandard_gates (#4035) * begin move to qiskit.circuit.gates * move more gates * move all standard gates * prepare SQU for moving not sure where to put it yet though * Move description of gates to new location Co-authored-by: Ali Javadi-Abhari <ali.javadi@ibm.com> * move new gates to circuit/gates, fix lint * new gates: dcx, iswap, rzx * fix test somehow cannot have * before u=None in SQUGate, otherwise the test_extensions_standard.test_to_matrix test fails due to a wrong num of args * return type is actually instructionset * fix tests * use circuit.gates in qiskit/ but keep old location in test * update extensions import to import form circ/gates * move equivalence lib to circuit/gates * move to library/standard_gates + kevin's comments * fix cyclic import and RST * rename leftover locations * add reno * fix cases missed in merge * Update qiskit/circuit/quantumcircuit.py Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com> * trailing whitespace * fix barrier import * allow gate import from qiskit.circuit * fix rxx, ryy, rzz docs (#4275) Co-authored-by: Ali Javadi-Abhari <ali.javadi@ibm.com> * fix left comments: circuit/gates to circuit/library * allow standard gate imports from circuit.library this also includes the instructions barrier, measure and reset * remove accidentally added file * add #4218 Co-authored-by: Luciano Bello <luciano.bello@ibm.com> * add #4294 Co-authored-by: Luciano Bello <luciano.bello@ibm.com> * import from new location * binding a submodule to name need py > 3.6 the circular dependency + name binding `import qiskit.circuit.library.standard_gates a gates` is only supported from python 3.7+ Co-authored-by: Ali Javadi-Abhari <ali.javadi@ibm.com> Co-authored-by: Erick Winston <ewinston@us.ibm.com> Co-authored-by: Luciano Bello <luciano.bello@ibm.com> Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b78f87a
commit 4bd91fe
Showing
113 changed files
with
6,061 additions
and
5,622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# 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 works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
"""Barrier instruction.""" | ||
|
||
from qiskit.exceptions import QiskitError | ||
from .instruction import Instruction | ||
|
||
|
||
class Barrier(Instruction): | ||
"""Barrier instruction.""" | ||
|
||
def __init__(self, num_qubits): | ||
"""Create new barrier instruction.""" | ||
super().__init__("barrier", num_qubits, 0, []) | ||
|
||
def inverse(self): | ||
"""Special case. Return self.""" | ||
return Barrier(self.num_qubits) | ||
|
||
def broadcast_arguments(self, qargs, cargs): | ||
yield [qarg for sublist in qargs for qarg in sublist], [] | ||
|
||
def c_if(self, classical, val): | ||
raise QiskitError('Barriers are compiler directives and cannot be conditional.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.