uniqc.algorithms.core.circuits.thermal_state module

Thermal state preparation circuit fragment.

uniqc.algorithms.core.circuits.thermal_state.thermal_state_circuit(n_qubits=None, beta=1.0, qubits=None)[source]

Build a thermal-state preparation fragment for \(H=\sum_i Z_i\).

c = thermal_state_circuit(3, beta=1.0)         # returns Circuit

Each qubit is prepared in \(\sqrt{p_0}|0\rangle + \sqrt{p_1}|1\rangle\) with \(p_0 = e^\beta / (e^\beta + e^{-\beta})\).

Parameters:
  • n_qubits – Number of qubits. May be None if qubits is given, in which case it is inferred as max(qubits) + 1.

  • beta – Inverse temperature (must be non-negative).

  • qubits – Qubit indices to use.

Returns:

A fresh Circuit containing the preparation fragment.

uniqc.algorithms.core.circuits.thermal_state.thermal_state_example()[source]

Return a 3-qubit thermal-state circuit at \(\beta=1\) for tests/docs.