Skip to content

Compute PauliStringLCU tolerances from energy error - #101

Merged
cferenba merged 2 commits into
mainfrom
cferenba/use-energy-error
Sep 22, 2026
Merged

cferenba merged 2 commits into
mainfrom
cferenba/use-energy-error

Conversation

@cferenba

Copy link
Copy Markdown
Member

This changes the epsilon and num_phase_qubits values for PauliStringLCU calculations (in both Qualtran and PyLIQTR) from hardcoded values to values computed based on the energy_error config parameter, based on @johngolden's suggested fixes.

@BrendanKKrueger BrendanKKrueger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm glad this is finally being added! I've been bothered by this lack for a long time, but never knew enough to implement it myself. Thanks!

Comment thread analysis/config.py Outdated
algorithm.method = "QPE: pyLIQTR qubitized"
# algorithm.method = "QPE: qualtran qubitization"
algorithm.num_phase_qubits = 12
# algorithm.num_phase_qubits = 12

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Probably better to just delete the line instead of commenting it out and leaving it in place

Comment thread analysis/unitary.py Outdated
class PauliStringLCU(LCUBlockEncoding):

def __init__(self, hamiltonian, prepare_type=None, probability_eps=0.002, **kwargs):
def __init__(self, hamiltonian, prepare_type=None, energy_error=0.001, **kwargs):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does a default value make sense, or could that lead to subtle errors where the user doesn't specify energy_error for some reason and gets the wrong energy error value?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, the default value probably doesn't make sense. Will remove.

@BrendanKKrueger BrendanKKrueger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm glad this is finally being added! I've been bothered by this lack for a long time, but never knew enough to implement it myself. Thanks!

@cferenba
cferenba merged commit cb0d818 into main Sep 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants