qemcmc.coarse_grain

Classes

CoarseGraining

CoarseGraining class to generate partitions of spins for quantum proposals.

Module Contents

class qemcmc.coarse_grain.CoarseGraining(n, subgroups=None, subgroup_probs=None, repeated=True)[source]

CoarseGraining class to generate partitions of spins for quantum proposals.

Parameters:
  • n (int) – Number of spins in the system.

  • subgroups (list[list[int]], optional) – A list of subgroups, where each subgroup is a list of spin indices. If None, the entire set of spins is treated as one subgroup.

  • subgroup_probs (list[float], optional) – A list of probabilities corresponding to each subgroup, used for weighted random selection. Must sum to 1. If None, subgroups are selected uniformly at random.

  • repeated (bool, optional) – If True, then multiple subgroups are run on the quantum computer in serial, if not then only one subgroup is selected at random and run on the quantum computer. Default is True.

_user_specified[source]
n[source]
subgroups = None[source]
subgroup_probs = None[source]
repeated = True[source]
sample() list[int][source]

Randomly samples a subgroup according to the specified probability distribution.

get_partitions(m: int) list[list[int]][source]

Returns partitions of spins for sequential quantum updates.

If the user provided explicit subgroups at initialisation, those are returned directly (all if repeated=True, otherwise just the first). If no subgroups were specified, random disjoint partitions of approximate size n/m are generated.

Parameters:

m (int) – The number of partitions to generate. Ignored if user-specified subgroups are provided.