qat.purr.compiler.config module

class CalibrationArguments

Bases: object

Base class for individual calibration arguments.

from_dict(dict_values)

Loads this dictionary into the arguments. Throws if key dosen’t exist on the object.

from_json(json)
to_json()
class CompilerConfig(repeats=None, repetition_period=None, results_format=None, metrics=MetricsType.Default, active_calibrations=None, optimizations=None, error_mitigation=None)

Bases: object

Full settings for the compiler. All values are defaulted on initialization.

If no explicit optimizations are passed then the default set of optimization for the language you’re attempting to compile will be applied.

classmethod create_from_json(json)
from_json(json)
to_json()
validate(hardware)
class ErrorMitigationConfig(value)

Bases: Flag

An enumeration.

Empty = 1
LinearMitigation = 4
MatrixMitigation = 2
class ExperimentalFeatures

Bases: object

error_mitigation = 1
class InlineResultsProcessing(value)

Bases: Flag

Results transforms applied directly to the read-out value on the QPU. In most situations applied post-execution, but can also be interwoven.

Binary = 2
Experiment = 5
NumpyArrays = 4
Program = 2
Raw = 1
class Languages(value)

Bases: IntEnum

An enumeration.

Empty = 0
QIR = 3
Qasm2 = 1
Qasm3 = 2
class MetricsType(value)

Bases: Flag

An enumeration.

Default = 6
Empty = 1
OptimizedCircuit = 2
OptimizedInstructionCount = 4
is_composite()

Any flags that are only composed of other ones should be signaled here. This is used for automatic metric generation and whether to build/validate this particular value.

snake_case_name()

Generate the Python field name that’ll be used to hold the results of this metric.

class OptimizationConfig

Bases: object

Base class for instantiated optimizations as well as mix-in classes. Built this way so we can mix and match optimization objects across multiple setups and languages without duplication.

default()

Apply default set of optimizations to the current set.

disable()

Disable all optimizations.

minimum()

Apply minimum working set for current optimizations.

class QIROptimizations

Bases: OptimizationConfig

class Qasm2Optimizations

Bases: Tket, Qiskit

class Qasm3Optimizations

Bases: OptimizationConfig

class QatOptimizations(value)

Bases: Flag

Flags for the various Qat optimizations we can apply.

Empty = 1
class Qiskit

Bases: OptimizationConfig

default()

Apply default set of optimizations to the current set.

class QiskitOptimizations(value)

Bases: Flag

Flags for the various Qiskit optimizations we can apply.

Empty = 1
class QuantumResultsFormat

Bases: object

binary()
Return type:

QuantumResultsFormat

binary_count()

Returns a count of each instance of measured qubit registers. Switches result format to raw.

raw()
Return type:

QuantumResultsFormat

squash_binary_result_arrays()

Squashes binary result list into a singular bit string. Switches results to binary.

class ResultsFormatting(value)

Bases: Flag

An enumeration.

BinaryCount = 1
DynamicStructureReturn = 2
SquashBinaryResultArrays = 4
class Tket(tket_optimization=None)

Bases: OptimizationConfig

default()

Apply default set of optimizations to the current set.

disable()

Disable all optimizations.

minimum()

Apply minimum working set for current optimizations.

class TketOptimizations(value)

Bases: Flag

Flags for the various Tket optimizations we can apply.

CliffordSimp = 32
ContextSimp = 8
DecomposeArbitrarilyControlledGates = 64
DefaultMappingPass = 2
DirectionalCXGates = 16
Empty = 1
FullPeepholeOptimise = 4
GlobalisePhasedX = 128
KAKDecomposition = 256
One = 18
PeepholeOptimise2Q = 512
RemoveBarriers = 2048
RemoveDiscarded = 1024
RemoveRedundancies = 4096
SimplifyMeasured = 16384
ThreeQubitSquash = 8192
Two = 30
get_config(lang, **kwargs)

Helper method to build a compiler config for a particular language. Forwards keywords to the CompilerConfig constructor.

get_optimizer_config(lang)

Returns the optimization config for this particular language. None if no valid ones found.

Return type:

Optional[OptimizationConfig]

get_serializable_types()