Repository navigation
Allow measure_entanglement to calculate entanglement for multiple qubits #206
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
Open
madcpf
wants to merge
10
commits into
quantumlib:main
Choose a base branch
from
madcpf:mul
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8893ced
update
madcpf bd4278b
update
madcpf e845d54
update
madcpf 48e61ce
format
madcpf 813714d
Address entanglement review feedback
madcpf 2c03bc9
Fix phase-aware multipartite correlation calculations
madcpf 347e0b3
Merge remote-tracking branch 'upstream/main' into mul
madcpf e72b400
Fix CI dependency compatibility
madcpf 02504e2
Constrain legacy Cirq CI dependencies
madcpf 87c21b0
Strengthen entanglement correctness regression tests
madcpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Copyright 2026 The Unitary Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import pathlib | ||
| import subprocess | ||
| import sys | ||
|
|
||
|
|
||
| SCRIPT = pathlib.Path(__file__).with_name("write-ci-requirements.py") | ||
|
|
||
|
|
||
| def _write_requirements(tmp_path, version): | ||
| output = tmp_path / "ci-requirements.txt" | ||
| subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| str(SCRIPT), | ||
| f"--out-fn={output}", | ||
| f"--relative-cirq-version={version}", | ||
| ], | ||
| check=True, | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| return output.read_text() | ||
|
|
||
|
|
||
| def test_current_cirq_ci_pins_legacy_setuptools(tmp_path): | ||
| requirements = _write_requirements(tmp_path, "current") | ||
|
|
||
| assert "cirq-core==0.15.0" in requirements | ||
| assert "cirq-google==0.15.0" in requirements | ||
| assert "setuptools<82" in requirements | ||
|
|
||
|
|
||
| def test_next_cirq_ci_does_not_constrain_setuptools(tmp_path): | ||
| requirements = _write_requirements(tmp_path, "next") | ||
|
|
||
| assert "cirq-core>=1.0.0" in requirements | ||
| assert "cirq-google>=1.0.0" in requirements | ||
| assert "\nsetuptools\n" in requirements | ||
| assert "setuptools<82" not in requirements |
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I think this block is fairly tough to follow. I would add comments below or in the function's docstring to explain the implementation details.
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.
Addressed. I expanded the docstring/comments around the multipartite entropy calculation, and the follow-up
2c03bc9makes the definition explicit: bipartite quantum mutual information for two objects and quantum dual total correlation for N > 2, with the corresponding entropy formula and reference.