quenchcircuitmaker
qemcmc.circuits.quenchcircuitmaker ¶
QuenchCircuitMaker ¶
Bases: BaseCircuitMaker
The total Hamiltonian simulated by the circuit is
``H = γ H_mixer + (1 - γ) α H_problem``
where H_problem encodes the classical energy model and H_mixer
corresponds to a transverse-field term. The evolution time t and
number of Trotter steps r are passed per call, giving an effective
Trotter step size of δt = t / r. The evolution is approximated
using Trotterisation via qml.ApproxTimeEvolution.
Source code in src/qemcmc/circuits/quenchcircuitmaker.py
get_state_vector ¶
Evolve the initial state and return the final state vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
Input bitstring representing the initial state. |
required |
weights
|
list of float
|
Coefficients for the problem Hamiltonian terms. |
required |
time
|
float
|
Total evolution time. |
required |
r
|
int
|
Number of Trotter steps for the approximate time evolution. |
required |
mix_weight
|
float
|
Coefficient for the mixer Hamiltonian. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The final state vector. |
Notes
The total Hamiltonian simulated by the circuit is a weighted sum of the problem Hamiltonian terms and the mixer Hamiltonian:
In Ferguson et al. (2025) [arXiv:2506.19538], we use gammas to weight the entire problem Hamiltonian vs the mixer vs the constraint Hamiltonian, such that the total Hamiltonian is:
H = g_p * H_p + g_m * H_m + g_c * H_c
but here we allow for separate weights for each coupling tensor term, as well as a separate gamma for the mixer. The total Hamiltonian is then:
H = (w_b1*H_b1 + w_b2*H_b2 + ... + w_b2*H_bm) + g_m * H_m
In other words, the constraint hamiltonian is absorbed in the coupling list, and weighted by the corresponding gamma in the gammas list. This allows for more flexible weighting of different terms, and also allows us to use the same code for both constrained and unconstrained problems (by simply including or excluding the constraint Hamiltonian in the coupling list and adjusting the gammas accordingly).
Note that it is assumed that each term is already normalised appropriately, so the gammas can be interpreted as the relative weights of each term in the total Hamiltonian.
Source code in src/qemcmc/circuits/quenchcircuitmaker.py
get_sample ¶
Generate a single sample by evolving the system and measuring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_cg
|
str
|
Input bitstring for the subgroup. |
required |
time
|
float
|
Total evolution time. |
required |
r
|
int
|
Number of Trotter steps for the approximate time evolution. |
required |
mix_weight
|
float
|
Coefficient for the mixer Hamiltonian. |
required |
local_couplings
|
list
|
Coupling tensors for the subgroup. |
required |
weights
|
list of float
|
Coefficients for the problem Hamiltonian terms. Defaults to ones. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
A single bitstring sample. |
Source code in src/qemcmc/circuits/quenchcircuitmaker.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
update ¶
Update a bitstring by evolving a subgroup.
This performs a time evolution on a coarse-grained Hamiltonian to get s' from s.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
The initial bitstring. |
required |
subgroup_choice
|
list of int
|
Indices of the subgroup to evolve. |
required |
local_couplings
|
list
|
Coupling tensors for the subgroup. |
required |
gamma
|
float
|
Mixing parameter. |
required |
time
|
float
|
Evolution time. |
required |
r
|
int
|
Number of Trotter steps for the approximate time evolution. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The updated bitstring s'. |