-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement Qdrift as ProductFormula #7281
Conversation
Pull Request Test Coverage Report for Build 1515324749
💛 - Coveralls |
releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Julien Gacon <gaconju@gmail.com>
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.
One super minor comment, but otherwise this looks fine to accept to me.
All changes have been marked resolved by Dariusz
I originally had this as automerge (trying to get things merged before the Monday/Tuesday rush), but then I realised that @dlasecki had never actually commented on whether the algorithm does exactly what it's supposed to, so I don't know if his original review was meant to be a complete check of everything he thought needed changing. I don't know enough about this particular expansion to approve that properly, so I'll wait for Dariusz to give his tick as well before merging. |
@@ -113,6 +118,27 @@ def test_suzuki_trotter_manual(self): | |||
|
|||
self.assertEqual(evo_gate.definition.decompose(), expected) | |||
|
|||
@data( | |||
(X + Y, 0.5, 1, [(Pauli("X"), 0.5), (Pauli("X"), 0.5)]), | |||
(X, 0.238, 2, [(Pauli("X"), 1.050420168067227)]), |
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.
This test fails for me locally (the second one only) and I don't quite get why the coefficients of the sampled ops should be different than 1 since we now don't change the coeffs anymore
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.
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.
ah maybe making num_gates to an int makes the test fail
@anedumla I added a functional test to see if it works as expected and had to change the |
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.
LGTM thanks for the implementation!
Summary
This pull request implements the QDrift method of Trotterization as a product formula and fixes Issue #7218.
Details and comments
The implementation is virtually the same as in https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/opflow/evolutions/trotterizations/qdrift.py with the only change being that
becomes
to make sure that the sample size is always at least 1 and because N is chosen to satisfy an error bound, so the former
int(N * self.reps)
would not have been strictly correct in some instances.