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

Removed 2pi wrapping for global phase parameter #10631

Merged
merged 9 commits into from
Nov 6, 2023

Conversation

Raghav-Bell
Copy link
Contributor

It fixes #10569

Summary

Removed _mod_2pi function.

Details and comments

It is similiar to Qiskit/qiskit-ibm-provider#689

@Raghav-Bell Raghav-Bell requested a review from a team as a code owner August 15, 2023 11:36
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Aug 15, 2023
@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

@coveralls
Copy link

coveralls commented Aug 15, 2023

Pull Request Test Coverage Report for Build 5874648858

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • 62 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.02%) to 87.246%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/scheduling/dynamical_decoupling.py 3 4 75.0%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 93.76%
crates/qasm2/src/lex.rs 4 90.89%
qiskit/visualization/state_visualization.py 57 57.55%
Totals Coverage Status
Change from base Build 5861497685: 0.02%
Covered Lines: 74290
Relevant Lines: 85150

💛 - Coveralls

@Raghav-Bell
Copy link
Contributor Author

Raghav-Bell commented Aug 16, 2023

tox -elint is failing on python qiskit-terra/tools/find_optional_imports.py with ERROR: sympy is imported via qiskit.circuit.quantumcircuit. Any guess how to fix this.

@mtreinish
Copy link
Member

tox -elint is failing on python qiskit-terra/tools/find_optional_imports.py with ERROR: sympy is imported via qiskit.circuit.quantumcircuit. Any guess how to fix this.

I assume you're on windows, this is caused by the fact that symengine is an optional dependency on windows because of pip doesn't let us distinguish between 64bit and 32 bit platforms for dependencies (symengine only works with 64bit). If you're running windows 64bit and a 64bit build of python you can do .tox/lint/Scripts/pip install symengine to install tox in the lint environment and then rerun tox -elint to fix that. Otherwise you can just ignore that specific error locally because it won't fail in CI (because CI runs on linux which requires symengine).

@Cryoris
Copy link
Contributor

Cryoris commented Aug 18, 2023

The changes LGTM, could you add a test to check the fix? You could e.g use the example from #10569 and ensure that it now runs as expected.

@coveralls
Copy link

coveralls commented Sep 23, 2023

Pull Request Test Coverage Report for Build 6771583945

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • 25 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.02%) to 86.923%

Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 84.15%
crates/qasm2/src/lex.rs 5 91.16%
crates/qasm2/src/parse.rs 18 96.2%
Totals Coverage Status
Change from base Build 6770066582: -0.02%
Covered Lines: 74343
Relevant Lines: 85527

💛 - Coveralls

PadDynamicalDecoupling(self.durations, dd_sequence),
]
)
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest replacing this block with an assertion. Either just on pm.run(qc), or perhaps on qc.global_phase equal to that of the output circuit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have replaced it with following code block:

self.assertEqual(qc.global_phase + 3.14159265358979, pm.run(qc).global_phase)

But getting following error while testing:

AssertionError: ParameterExpression(a + 3.14159265358979) != ParameterExpression(a + 3.14159265358979)

Can you please help me in debugging this .

Copy link
Contributor

Choose a reason for hiding this comment

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

how about self.assertEqual(qc.global_phase + np.pi, pm.run(qc).global_phase)?

@Raghav-Bell
Copy link
Contributor Author

As of deprecation in 0.21 dynamical decoupling is replaced with paddynamical decoupling. These conflicts are due to merge of #10754 . Let me try to fix this.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Thanks for this. I've just force-pushed some changes to this to fix up the merge-conflict resolution commits that had gone a bit wrong, but it looks ok to me now.

@jakelishman jakelishman added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Nov 6, 2023
@jakelishman jakelishman added this to the 0.45.1 milestone Nov 6, 2023
@jakelishman jakelishman added this pull request to the merge queue Nov 6, 2023
Merged via the queue into Qiskit:main with commit 838e966 Nov 6, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: transpiler Issues and PRs related to Transpiler
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cannot apply dynamical decoupling on a circuit with parameterized global phase
7 participants