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

add abs method to ParameterExpression #9309

Merged
merged 31 commits into from
May 17, 2023

Conversation

king-p3nguin
Copy link
Contributor

@king-p3nguin king-p3nguin commented Dec 20, 2022

Summary

Co-authored-by: @czachow Christopher.zachow@sva.de

  • added an __abs__() method to the class ParameterExpression
  • added an abs() method to the class ParameterExpression
    • This is done because a magic method like __abs__() will not be documented
  • added several tests which will test the function of the method

Details and comments

@king-p3nguin king-p3nguin requested a review from a team as a code owner December 20, 2022 16:09
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Dec 20, 2022
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, but since @jakelishman reviewed the first version of the PR it would be good if he could have another look 🙂

qiskit/circuit/__init__.py Show resolved Hide resolved
test/python/circuit/test_parameters.py Outdated Show resolved Hide resolved
test/python/circuit/test_parameters.py Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jan 23, 2023

Pull Request Test Coverage Report for Build 5001210513

  • 5 of 8 (62.5%) changed or added relevant lines in 1 file are covered.
  • 90 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.02%) to 85.911%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/parameterexpression.py 5 8 62.5%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 1 91.9%
qiskit/circuit/library/data_preparation/pauli_feature_map.py 7 90.59%
qiskit/tools/jupyter/jupyter_magics.py 38 0%
qiskit/tools/jupyter/library.py 44 0%
Totals Coverage Status
Change from base Build 4947759363: -0.02%
Covered Lines: 71099
Relevant Lines: 82759

💛 - Coveralls

…b38b.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for all the updates!

@Cryoris Cryoris added the Changelog: New Feature Include in the "Added" section of the changelog label May 17, 2023
@Cryoris Cryoris enabled auto-merge May 17, 2023 09:02
@Cryoris Cryoris added this pull request to the merge queue May 17, 2023
Merged via the queue into Qiskit:main with commit 1d844ec May 17, 2023
@king-p3nguin king-p3nguin deleted the pr-parameterexpression_abs branch May 17, 2023 20:51
king-p3nguin added a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
* added abs method to parameterexpression

* fixed wrong call in abs function

* changed definition of abs to __abs__

* additionally implemented __le__, __ge__, __lt__, __gt__ operators

* fixed requested features and implemented more tests for __lt__, __gt__

* fixed lint errors in parameterexpression and its tests

* fixed formatting error in docstrings

* removed __lt__ and friends, fixed recommendations

* added more tests for abs function

* fixed lint

* added a releasenote to document change

* mod function & add more tests

* add new line at the end of file

* fix lint

* add alias of __abs__ for doc

* mod test_compile_with_ufunc

* add test

* fix test

* fix test

* fix test

* fix test

* fix test

* Update test_parameters.py

* Update releasenotes/notes/add-abs-to-parameterexpression-347ffef62946b38b.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

---------

Co-authored-by: Christopher Zachow <christopher.zachow@sva.de>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
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 Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add support for abs to ParameterExpression
5 participants