Skip to content
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

Parameter conjugate #4619

Merged
merged 2 commits into from
Jun 26, 2020
Merged

Parameter conjugate #4619

merged 2 commits into from
Jun 26, 2020

Conversation

Cryoris
Copy link
Contributor

@Cryoris Cryoris commented Jun 26, 2020

Summary

Adds conjugate to the ParameterExpression. Since they are real, conjugate returns self.
This adds flexibility and convenience, since real numbers in Python (such as float) also support this.

Details and comments

This is analogous to real numbers in Python,

>>> import numpy
>>> numpy.conj(float(1)) 
1.0
>>> numpy.conj(Parameter('x'))  
x  # before: TypeError: loop of ufunc does not support argument 0 of type Parameter which has no callable conjugate method

@Cryoris Cryoris requested a review from kdk June 26, 2020 10:34
@Cryoris Cryoris requested a review from a team as a code owner June 26, 2020 10:34
@kdk kdk added the Changelog: API Change Include in the "Changed" section of the changelog label Jun 26, 2020
@kdk kdk added this to the 0.15 milestone Jun 26, 2020
@kdk kdk merged commit 5f71bf2 into Qiskit:master Jun 26, 2020
@Cryoris Cryoris deleted the parameter-conjugate branch June 29, 2020 07:30
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
* add reno

* add test
@mtreinish mtreinish added Changelog: New Feature Include in the "Added" section of the changelog and removed Changelog: API Change Include in the "Changed" section of the changelog labels Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants