utils
qemcmc.utils ¶
MCMCState
dataclass
¶
Represents a single step in an MCMC trajectory.
Stores the proposed configuration, whether it was accepted by the Metropolis rule, its energy, and the position of the step in the chain.
MCMCChain
dataclass
¶
Container for the sequence of states produced during an MCMC run.
This class records all proposed states, tracks accepted configurations, and provides helper methods for extracting trajectories, energies, and empirical distributions from the Markov chain.
Source code in src/qemcmc/utils/helpers.py
get_random_state ¶
Generate a random state for a given number of spins.
Parameters: num_spins (int): The number of spins in the system. Returns: str: A bitstring representing the random state.
Source code in src/qemcmc/utils/helpers.py
get_all_possible_states ¶
Returns all possible binary strings of length n=num_spins
Paremeters: num_spins: n length of the bitstring Returns: list: A list of all possible binary strings of length num_spins.
Source code in src/qemcmc/utils/helpers.py
validate_subgroups ¶
Validate coarse-graining subgroups.
Requirements: - subgroups is a non-empty list of non-empty sequences - each element is an int in [0, n-1] - each subgroup has no duplicate indices - every spin from 0 to n-1 appears in at least one subgroup
Raises:
| Type | Description |
|---|---|
ValueError / TypeError
|
|