qarp.utils

Random circuit instances and toy-model Hamiltonians. Public depth: flat. Submodules are private.

qarp.utils.FH_ham_and_wf(n: int, t: float = 1.4, U: float = 2.31)[source]
qarp.utils.FH_ham_and_wf_singles_and_doubles(n: int, t: float = 1.4, U: float = 2.31, generalised: bool = True)[source]
qarp.utils.generate_random_circuit(num_gates: int, num_qubits: int, gate_set: List[GateType]) SimpleBlock[source]

Build a random SimpleBlock of num_gates gates.

Parameters:
  • num_gates – Number of gates to emit.

  • num_qubits – Register size.

  • gate_set – Allowed qarpx.GateType values. May mix single-qubit no-param, single-qubit parametric, two-qubit no-param, and controlled-rotation gates.

Returns:

A built SimpleBlock with num_gates random gates.

Raises:
  • AssertionError – If any of num_gates, num_qubits or len(gate_set) is not strictly positive.

  • ValueError – If a gate in gate_set isn’t in one of the supported categories above.