Skip to content

revise the created pauli_term_grouping.py #1100

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hofong428
Copy link

Optimized Pauli term grouping strategies for measurement reduction in fermionic simulations.
Based on research showing up to 50% measurement reduction compared to traditional techniques.

Copy link

google-cla bot commented Jul 29, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

"""

import numpy as np
from typing import List, Dict, Set, Tuple, Optional, Union

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'Union' is not used.
Import of 'Optional' is not used.
from typing import List, Dict, Set, Tuple, Optional, Union
import networkx as nx
from collections import defaultdict, Counter
from itertools import combinations

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'combinations' is not used.

try:
from openfermion.ops import QubitOperator
from openfermion.utils import commutator, count_qubits

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'commutator' is not used.
Import of 'count_qubits' is not used.
# Apply physical constraints
n_clusters = max(2, min(n_clusters, self.n_terms // 3))

except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
"""
# Compute pairwise distances
distances = pdist(embedding, metric='euclidean')
distance_matrix = squareform(distances)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable distance_matrix is not used.
best_score = score
best_n_clusters = n_clusters

except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.

if __name__ == "__main__":
# Run comprehensive demonstration
demo_results = demonstrate_advanced_pauli_grouping()

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'demo_results' is not used.
@mhucka
Copy link
Contributor

mhucka commented Aug 1, 2025

@hofong428 thank you for this work. It looks like Google lacks evidence of a Contributor License Agreement (CLA) having been accepted – could you check the instructions and do that? (It won't ask you to give up any rights.)

Also, could you provide a somewhat more informative title for this PR? It looks like the revision has to do with optimizing performance, so perhaps it should mention that. This will make it easier for people to understand what's going on in the future.

@hofong428
Copy link
Author

hofong428 commented Aug 2, 2025 via email

@mhucka
Copy link
Contributor

mhucka commented Aug 3, 2025

I've tried to conduct the PRs as codebatai(my startup company), or is only personal PR allowable?

Yes, it is normally possible for an employee of a company to submit contributions too. It is up to the company to set guidelines for what their employees can do. In either case, a CLA is still needed by Google. The comment by the CLA bot above includes a link to more information. The gist of it is that you visit https://cla.developers.google.com/.

Near the bottom of that page, there should be two buttons: one for "Only yourself" and another for "Your employer". To understand the implications of the choices, it's best to read the info on the "About" page mentioned below the buttons. (Here's a direct link: https://cla.developers.google.com/about) The "About" page (the page describing CLAs) is a bit long, but hopefully it will not be alarming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants