Update circuit.delay to accept parameterized duration (Fix #6029)#6225
Merged
mergify[bot] merged 9 commits intoQiskit:mainfrom Apr 24, 2021
itoko:fix-issue-6029-parameterized-delay
Merged
Update circuit.delay to accept parameterized duration (Fix #6029)#6225mergify[bot] merged 9 commits intoQiskit:mainfrom itoko:fix-issue-6029-parameterized-delay
mergify[bot] merged 9 commits intoQiskit:mainfrom
itoko:fix-issue-6029-parameterized-delay
Conversation
mtreinish
added a commit
to mtreinish/qiskit-core
that referenced
this pull request
May 5, 2021
The definition of the Delay's validate_parameter method was changed in PR Qiskit#6225, this just updates it to use the new ParameterExpression.is_real() so it works in a world with symengine.
mergify Bot
pushed a commit
that referenced
this pull request
May 5, 2021
* Use symengine for parameter and parameter expressions This commit uses symengine by default everywhere sympy was previously used. Symengine is a symbolic engine written in C++ that offers significantly improved performance over sympy. However, because there isn't 32 bit wheels available on pypi we can't have it as a hard requirement in all environments. This adds it as a requirement on supported platforms 64bit intel, arm64/aarch64, and ppc64le so by default we have the better performance where available and in the code there is a fallback to use sympy if it's not available. * Add pickle support * Pickle fixes * Convert to sympy expression for eq and str * Fix lint * Fix vector pickle * Avoid runtime import for symengine Local benchmarking shows that importing symengine is not nearly as slow as importing sympy. So to avoid the runtime overhead and reduce the complexity this commit switches to use module level imports for symengine. * Fix test failures due to precision differences * More fixes from subtle behavior differences * Fix some of the gradient failures * Fix failure in sympy fallback path * Fix gradient tests * Adjust complex check logic * Fix lint * Workaround pulse failure * Adjust failing test to use np allclose * Add release note * Add is_real method to parameterexpression * Run black post-rebase * Remove symengine/sympy usage from gradients tests * Remove unused import * Fix Delay instruction's new validate is_real check The definition of the Delay's validate_parameter method was changed in PR #6225, this just updates it to use the new ParameterExpression.is_real() so it works in a world with symengine.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
circuit.Delayto be able to accept a parameterized duration as well as a fixed (integer/float) duration.Fixes #6029.
Details and comments
Now you can specify a duration of delay as a
ParameterExpressionobject when appending it to a circuit, and assign some value to the parameter afterward.