VariationalCircuits Module
Symbolic support for VQE measurement programs and QPE resource estimation.
Provides tools for grouping Hamiltonian terms into qubit-wise commuting measurement bases (reducing the number of measurement circuits needed in VQE), shot-budget estimation, and QPE circuit resource estimation using first-order Trotterization.
Types
| Type | Description |
|
A measurement basis for simultaneous measurement of commuting Pauli terms. |
|
|
Complete measurement program for estimating ⟨H⟩. |
|
|
QPE resource estimate for a Hamiltonian simulation circuit. |
Functions and values
| Function or value |
Description
|
Full Usage:
estimateShots epsilon hamiltonian
Parameters:
float
-
Target precision for the energy estimate.
hamiltonian : PauliRegisterSequence
-
The Hamiltonian as a sum of Pauli strings.
Returns: int
Estimated number of measurement shots (rounded up).
|
Estimate total measurement shots needed for precision ε on ⟨H⟩. Uses the formula: shots ≈ (Σ|cₖ|)² / ε², derived from the variance of the estimator for the expectation value of a sum of Pauli terms.
|
Full Usage:
groupCommutingTerms hamiltonian
Parameters:
PauliRegisterSequence
-
The Hamiltonian as a sum of Pauli strings.
Returns: MeasurementProgram
A MeasurementProgram describing the grouped bases.
|
Group Hamiltonian terms into qubit-wise commuting measurement bases. Uses a greedy algorithm: sort terms by |coefficient| descending, then assign each term to the first compatible group. This is a heuristic — optimal grouping is NP-hard in general.
|
Full Usage:
qpeResources precisionBits hamiltonian dt
Parameters:
int
-
Number of ancilla bits for phase readout.
hamiltonian : PauliRegisterSequence
-
The Hamiltonian as a sum of Pauli strings.
dt : float
-
Trotter time step size.
Returns: QPEResourceEstimate
A QPEResourceEstimate with circuit resource counts.
|
QPE resource estimation for a given precision and Hamiltonian. Estimates the resources for quantum phase estimation using first-order Trotterization for the controlled-U circuit. The number of controlled-U applications scales as 2^(precisionBits) - 1.
|
Full Usage:
qubitWiseCommutes a b
Parameters:
PauliRegister
-
First Pauli register.
b : PauliRegister
-
Second Pauli register.
Returns: bool
true if the two registers qubit-wise commute.
|
Two Pauli operators qubit-wise commute if at each position either both are the same or at least one is I.
|