qlauncher.routines.qiskit.mitigation_suppression.mitigation#

Summary#

Classes:

NoMitigation

PauliTwirling

Error mitigation technique based on averaging the results of running multiple "twirled" versions of the initial circuit.

WeighedMitigation

ZeroNoiseExtrapolation

Error mitigation technique based on fitting a model to data generated by running a circuit made to multiply the error of the original circuit, then predicting the values at x=0 (original circuit)

Reference#

class qlauncher.routines.qiskit.mitigation_suppression.mitigation.NoMitigation[source]#

Bases: CircuitExecutionMethod

compatible_circuit: type | UnionType = qiskit.circuit.quantumcircuit.QuantumCircuit | cirq.circuits.circuit.Circuit#
sample(circuit: CIRCUIT_FORMATS, backend: GateCircuitBackend, shots: int = 1024) dict[str, int][source]#

Sample circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • backend (QiskitBackend) – Backend to run on.

  • shots (int, optional) – Number of samples to collect. Defaults to 1024.

Returns:

Bitstring counts.

Return type:

dict[str,int]

estimate(circuit: QuantumCircuit, observable: SparsePauliOp, backend: QiskitBackend) float[source]#

Estimate energy of observable after running a given circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • observable (SparsePauliOp) – Observable to estimate.

  • backend (QiskitBackend) – Backend to use.

Returns:

Estimated energy of the observable.

Return type:

float

class qlauncher.routines.qiskit.mitigation_suppression.mitigation.WeighedMitigation(mitigation_methods: list[CircuitExecutionMethod], method_weights: list[float] | None = None)[source]#

Bases: CircuitExecutionMethod

sample(circuit: QuantumCircuit, backend: QiskitBackend, shots: int = 1024) dict[str, int][source]#

Sample circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • backend (QiskitBackend) – Backend to run on.

  • shots (int, optional) – Number of samples to collect. Defaults to 1024.

Returns:

Bitstring counts.

Return type:

dict[str,int]

estimate(circuit: QuantumCircuit, observable: SparsePauliOp, backend: QiskitBackend) float[source]#

Estimate energy of observable after running a given circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • observable (SparsePauliOp) – Observable to estimate.

  • backend (QiskitBackend) – Backend to use.

Returns:

Estimated energy of the observable.

Return type:

float

class qlauncher.routines.qiskit.mitigation_suppression.mitigation.PauliTwirling(num_random_circuits: int, max_substitute_gates_per_circuit: int = 4, do_transpile: bool = True)[source]#

Bases: CircuitExecutionMethod

Error mitigation technique based on averaging the results of running multiple “twirled” versions of the initial circuit. The method appends additional gates on both sides of random 2 qubit gates (cx, ecr).

compatible_circuit#

alias of QuantumCircuit

sample(circuit: QuantumCircuit, backend: QiskitBackend, shots: int = 1024) dict[str, int][source]#

Sample circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • backend (QiskitBackend) – Backend to run on.

  • shots (int, optional) – Number of samples to collect. Defaults to 1024.

Returns:

Bitstring counts.

Return type:

dict[str,int]

estimate(circuit: QuantumCircuit, observable: SparsePauliOp, backend: QiskitBackend) float[source]#

Estimate energy of observable after running a given circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • observable (SparsePauliOp) – Observable to estimate.

  • backend (QiskitBackend) – Backend to use.

Returns:

Estimated energy of the observable.

Return type:

float

class qlauncher.routines.qiskit.mitigation_suppression.mitigation.ZeroNoiseExtrapolation(num_extrapolations: int = 4, polynomial_degree: int = 3, mode: Literal['linear', 'exponential'] = 'linear')[source]#

Bases: CircuitExecutionMethod

Error mitigation technique based on fitting a model to data generated by running a circuit made to multiply the error of the original circuit, then predicting the values at x=0 (original circuit)

compatible_circuit#

alias of QuantumCircuit

sample(circuit: QuantumCircuit, backend: GateCircuitBackend, shots: int = 1024) dict[str, int][source]#

Sample circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • backend (QiskitBackend) – Backend to run on.

  • shots (int, optional) – Number of samples to collect. Defaults to 1024.

Returns:

Bitstring counts.

Return type:

dict[str,int]

estimate(circuit: QuantumCircuit, observable: SparsePauliOp, backend: QiskitBackend) float[source]#

Estimate energy of observable after running a given circuit on the backend.

Parameters:
  • circuit (QuantumCircuit) – Circuit to run.

  • observable (SparsePauliOp) – Observable to estimate.

  • backend (QiskitBackend) – Backend to use.

Returns:

Estimated energy of the observable.

Return type:

float