uniqc.algorithmics.circuits.thermal_state module#
Thermal state preparation circuit.
- uniqc.algorithmics.circuits.thermal_state.thermal_state_circuit(circuit, beta, qubits=None)[source]#
Prepare a thermal state via single-qubit rotations.
For the transverse-field-free Hamiltonian \(H = \sum_i Z_i\), the thermal (Gibbs) state at inverse temperature \(\beta\) factorises into a product of single-qubit states. Each qubit is prepared in
\[\sqrt{p_0}\,|0\rangle + \sqrt{p_1}\,|1\rangle\]where
\[p_0 = \frac{e^{\beta}}{e^{\beta}+e^{-\beta}}, \qquad p_1 = 1 - p_0.\]This is achieved by applying \(R_y(\theta)\) with \(\theta = 2\arccos(\sqrt{p_0})\) to every qubit independently.
This is a lightweight, circuit-only counterpart of
state_preparation.thermal_statefor the default Hamiltonian case.- Parameters:
- Raises:
ValueError – beta is negative.
- Return type:
None
Example
>>> from uniqc.circuit_builder import Circuit >>> from uniqc.algorithmics.circuits import thermal_state_circuit >>> c = Circuit(3) >>> thermal_state_circuit(c, beta=1.0)