qat.runtime.passes.legacy.transform module

class QiskitErrorMitigation

Bases: TransformPass

Implements readout error mitigation for legacy Qiskit engines.

Because the legacy Qiskit engine returns results in a format that is not consistent with other legacy engines (or refactored ones), it requires its own implementation. The refactored engine will be written so that the output of the results are formatted in a way that the runtime will expect to receive them. This is just a work around to support legacy engines in the new pipelines API.

classical_to_quantum_mapping(package)

Generates a mapping between classical register indices and qubit indices.

This would probably be an analysis pass for refactored code, but since its only used here, its just included within this transformation pass.

Parameters:

package (QiskitBuilder) – The Qiskit instruction builder.

Raises:

ValueError – If the assign variables is not in the expected format, an error is thrown.

Return type:

Dict[str, int]

Returns:

Returns the mapping as a dictionary.

index_pattern = re.compile('(.*)\\[(?P<clbit_index>[0-9]+)\\]_(?P<qubit_index>[0-9]+)')
run(acquisitions, *args, compiler_config, package, **kwargs)
Parameters:
  • acquisitions (Dict[str, any]) – Acquisition data returned from the Qiskit simulator.

  • compiler_config (CompilerConfig) – The compiler config contains the error mitigation configuration.

  • package (QiskitBuilder) – The Qiskit instruction builder.

Raises:

ValueError – Multiple registers are not allowed with error mitigation.

Return type:

Dict[str, any]

Returns:

The transformed result acquisitions.

class QiskitSimplifyResults

Bases: TransformPass

Strips away randomly generated names.

This is the same as the simplify_results function in ResultsTransform.

run(acquisitions, *args, **kwargs)
Parameters:

acquisitions (Dict[str, any]) – Acquisition data returned from the Qiskit simulator.

Returns:

The acquisition data simplified.

class QiskitStripMetadata

Bases: TransformPass

Detects if Qiskit is returning meta data associated with the simulation, and trims it away if so.

run(acquisitions, *args, **kwargs)
Parameters:

acquisitions (Dict[str, any]) – Acquisition data returned from the Qiskit simulator.

Returns:

The acquisition data with metadata stripped away (if found).