-
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.
Constructing Cliffords from quantum circuits with other Cliffords (#9169
) * Fix to visualize circuits containing cliffords * Fix to creating cliffords from clifford circuits that contain Clifford objects * removing comment * extending CollectCliffords to circuits with cliffords, linear functions and pauli gates * Addings tests * typo * release notes * adding a test that a Clifford can be constructed from a quantum circuit with various clifford-like objects * Removing redundant copy * updating release notes * Improve test Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Matthew Treinish <[email protected]>
- Loading branch information
1 parent
b2311c4
commit 13bb17c
Showing
5 changed files
with
253 additions
and
1 deletion.
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
47 changes: 47 additions & 0 deletions
47
releasenotes/notes/improve-collect-cliffords-f57aeafe95460b18.yaml
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,47 @@ | ||
--- | ||
features: | ||
- | | ||
Extending :class:`~CollectCliffords` transpiler pass to collect and combine blocks | ||
of "clifford gates" into :class:`qiskit.quantum_info.Clifford` objects, where the | ||
"clifford gates" may now also include objects of type :class:`.LinearFunction`, | ||
:class:`qiskit.quantum_info.Clifford`, and :class:`~qiskit.circuit.library.PauliGate`. | ||
As an example:: | ||
from qiskit.circuit import QuantumCircuit | ||
from qiskit.circuit.library import LinearFunction, PauliGate | ||
from qiskit.quantum_info.operators import Clifford | ||
from qiskit.transpiler.passes import CollectCliffords | ||
from qiskit.transpiler import PassManager | ||
# Create a Clifford | ||
cliff_circuit = QuantumCircuit(2) | ||
cliff_circuit.cx(0, 1) | ||
cliff_circuit.h(0) | ||
cliff = Clifford(cliff_circuit) | ||
# Create a linear function | ||
lf = LinearFunction([[0, 1], [1, 0]]) | ||
# Create a pauli gate | ||
pauli_gate = PauliGate("XYZ") | ||
# Create a quantum circuit with the above and also simple clifford gates. | ||
qc = QuantumCircuit(4) | ||
qc.cz(0, 1) | ||
qc.append(cliff, [0, 1]) | ||
qc.h(0) | ||
qc.append(lf, [0, 2]) | ||
qc.append(pauli_gate, [0, 2, 1]) | ||
qc.x(2) | ||
# Run CollectCliffords transpiler pass | ||
qct = PassManager(CollectCliffords()).run(qc) | ||
All the gates will be collected and combined into a single Clifford. Thus the final | ||
circuit consists of a single Clifford object. | ||
fixes: | ||
- | | ||
Restoring the functionality to construct :class:`qiskit.quantum_info.Clifford` | ||
objects from quantum circuits containing other :class:`qiskit.quantum_info.Clifford` | ||
objects. |
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