LogicalQ.Benchmarks

Functions

mirror_benchmarking([n_qubits, qubits, ...])

Constructs circuits composed of various gates and composes the full inverse as a circuit, such that the composite operation is the identity if no errors occur.

randomized_benchmarking([n_qubits, qubits, ...])

Constructs circuits composed of various gates and the full inverse as a single gate, such that the composite operation is the identity if no errors occur.

quantum_volume([n_qubits, seed])

Generate quantum volume benchmark circuits.

quantum_teleportation(statevector[, barriers])

Generate a quantum teleportation circuit.

n_qubit_ghz_generation([n_qubits, barriers])

Generate an n-qubit GHZ state generation circuit.

Module Contents

LogicalQ.Benchmarks.mirror_benchmarking(n_qubits=None, qubits=None, circuit_length=2, gate_sample=None, measure=False, seed=None)

Constructs circuits composed of various gates and composes the full inverse as a circuit, such that the composite operation is the identity if no errors occur.

Parameters:
  • n_qubits (int) – The number of qubits in the circuit.

  • qubits (Iterable[int]) – A list of qubit indices in the circuit (default: list(range(n_qubits))).

  • circuit_length (int) – The desired total number of layers in the circuit.

  • gate_sample (str | Iterable[str | qiskit.circuit.Gate]) – An optional gate class, list of gate names, or list of Gates to sample from (default: Clifford gates).

  • measure (bool) – An optional bool to specify whether to append measurements at the end of the circuit (default: True).

  • seed (int) – An optional seed used during random choices (default: None).

Return type:

qiskit.QuantumCircuit

LogicalQ.Benchmarks.randomized_benchmarking(n_qubits=None, qubits=None, circuit_length=2, gate_sample=None, measure=False, seed=None)

Constructs circuits composed of various gates and the full inverse as a single gate, such that the composite operation is the identity if no errors occur.

Parameters:
  • n_qubits (int) – The number of qubits in the circuit.

  • qubits (Iterable[int]) – An optional list of qubit indices in the circuit (default: list(range(n_qubits))).

  • circuit_length (int) – The desired total number of layers in the circuit.

  • gate_sample (str | Iterable[str | qiskit.circuit.Gate]) – An optional gate class, list of gate names, or list of Gates to sample from (default: Clifford gates).

  • measure (bool) – An optional bool to specify whether to append measurements at the end of the circuit (default: True).

  • seed (int) – An optional seed used during random choices (default: None).

Return type:

qiskit.QuantumCircuit

LogicalQ.Benchmarks.quantum_volume(n_qubits=1, seed=None)

Generate quantum volume benchmark circuits.

Parameters:
  • n_qubits – Number of qubits available for the benchmark (sets a maximum iteration limit on the circuit width).

  • seed – Random seed for reproducibility (default: None).

Return type:

qiskit.QuantumCircuit

LogicalQ.Benchmarks.quantum_teleportation(statevector, barriers=False)

Generate a quantum teleportation circuit.

Parameters:
  • statevector (qiskit.quantum_info.Statevector | Iterable) – An arbitrary input state.

  • barriers – A bool specifying whether to append barriers between sections of the circuit (default: False).

Return type:

qiskit.QuantumCircuit

LogicalQ.Benchmarks.n_qubit_ghz_generation(n_qubits=3, barriers=False)

Generate an n-qubit GHZ state generation circuit.

Parameters:
  • n_qubits – Number of qubits in the GHZ state.

  • barriers – A bool specifying whether to append barriers between sections of the circuit (default: False).

Return type:

qiskit.QuantumCircuit