-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qiskit v0.18 updates #81
Conversation
…ng to list on the numpy parameters due to a C++ conversion bug in Qiskit Aer
…led rotation test as well as a CRY specific one
Codecov Report
@@ Coverage Diff @@
## master #81 +/- ##
=======================================
Coverage 99.11% 99.12%
=======================================
Files 7 7
Lines 340 341 +1
=======================================
+ Hits 337 338 +1
Misses 3 3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for catching this @antalszava!
"CRX": ex.CRXGate, | ||
"CRY": ex.CRYGate, | ||
"CRZ": ex.CRZGate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -59,23 +59,24 @@ def pauli_eigs(n): | |||
"PauliY": ex.YGate, | |||
"PauliZ": ex.ZGate, | |||
"Hadamard": ex.HGate, | |||
"CNOT": ex.CnotGate, | |||
"CZ": ex.CzGate, | |||
"CNOT": ex.CXGate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why they renamed this? CNOT is much more established than CX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good question. From what I saw they started porting every gate to this type of naming (e.g. FredkingGate
was also renamed to CSwapGate
) and I also noticed a base class for controlled X that was created.
They seem to not even mention CNOT
with the new formalism (once the CnotGate
has been deprecated, it will not be in there):
https://qiskit.org/documentation/_modules/qiskit/extensions/standard/x.html#CXGate
"""Tests loading a circuit with two qubit controlled rotations (except | ||
for CRY).""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this test doesn't check CRY
?
# This test will be merged into the test_controlled_rotations test once | ||
# the native CRY is used in Qiskit and not a set of instructions | ||
# yielded from decomposition is being added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this is the case? Is Qiskit doing the decomposition? Or PL core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's coming from Qiskit, but the question of why it is so got me wondering as well 😅 :
from qiskit import QuantumCircuit, QuantumRegister
q2 = QuantumRegister(2)
qc = QuantumCircuit(q2)
instr_set = qc.cry(0.5, q2[0], q2[1])
instr_set.data
Outputs:
[(<qiskit.extensions.standard.u3.U3Gate object at 0x7fec26d88350>, [Qubit(QuantumRegister(2, 'q2'), 1)], []), (<qiskit.extensions.standard.x.CXGate object at 0x7fec26d88510>, [Qubit(QuantumRegister(2, 'q2'), 0), Qubit(QuantumRegister(2, 'q2'), 1)], []), (<qiskit.extensions.standard.u3.U3Gate object at 0x7fec26d885d0>, [Qubit(QuantumRegister(2, 'q2'), 1)], []), (<qiskit.extensions.standard.x.CXGate object at 0x7fec26d88610>, [Qubit(QuantumRegister(2, 'q2'), 0), Qubit(QuantumRegister(2, 'q2'), 1)], [])]
Co-Authored-By: Josh Izaac <[email protected]>
With the new Qiskit version (
0.18
) certain changes were introduced affecting PennyLane-Qiskit as well.List of changes:
C++/Python conversion
The following
RuntimeError
is propagated fromQiskit-Aer
:A suggested quick fix was used for now.
More details can be found here:
Qiskit/qiskit-aer#692
Updated names for some gates
CnotGate
will become deprecated andCXGate
will be used in the future:https://qiskit.org/documentation/_modules/qiskit/extensions/standard/x.html#CXGate
CzGate
will become deprecated andCZGate
will be used in the future:https://qiskit.org/documentation/_modules/qiskit/extensions/standard/z.html#CZGate
The
CRXGate
and theCRYGate
were added on top of the previous gates available (e.g.CryGate
). CallingQuantumCircuit.cry
, however, still yields a decomposition usingU3
andCNOT
gates.Further renames:
ToffoliGate
->CCXGate
FredkinGate
->CSwapGate
Cu1Gate
->CU1Gate