quri_parts.backend.qubit_mapping module#

class BackendQubitMapping(mapping)#

Bases: object

Information related to qubit mapping of a backend.

Parameters:

mapping (Mapping[int, int]) –

mapping: Mapping[int, int]#

Mapping of qubit indices (from → to)

property circuit_transpiler: QubitRemappingTranspiler#

Returns a QubitRemappingTranspiler that remaps the qubit indices in the circuit.

unmap_sampling_counts(m)#

Converts SamplingCounts obtained from the backend so that the keys (measurement results) are represented in terms of qubits before mapping.

Parameters:

m (backend.SamplingCounts) –

Return type:

backend.SamplingCounts

class QubitMappedSamplingResult(sampling_result, qubit_mapping)#

Bases: SamplingResult

SamplingResult that takes the qubit mapping into consideration.

Given a “raw” sampling result from the backend, returns a converted result with the keys (measurement results) represented in terms of qubits before mapping.

Parameters:
sampling_result: SamplingResult#
qubit_mapping: BackendQubitMapping#
property counts: backend.SamplingCounts#

Measurement counts obtained by a sampling measurement.

class QubitMappedSamplingJob(sampling_job, qubit_mapping)#

Bases: SamplingJob

SamplingJob that takes the qubit mapping into consideration.

Given a “raw” sampling job from the backend, returns a converted job which returns a QubitMappedSamplingResult.

Parameters:
sampling_job: SamplingJob#
qubit_mapping: BackendQubitMapping#
result()#

Returns the result of the sampling job.

If the job is not complete, this method waits until the job finishes.

Return type:

QubitMappedSamplingResult