qat.experimental.dialect.results.ir.types module
Models the types in the results dialect, which are used for dataflow of results to collect and manipulate.
- class RecordType(schema)
Bases:
RecordTypeA type that carries a results record that can be added to a results collection.
This is used to represent a single record of results, e.g., from a single shot. It has the semantics of a dictionary, where the entries are accessed by string keys, and it can store arbitrary data types.
RecordTypeis modelled to be immutable, and must be complete when constructed.- Variables:
schema – The schema of the record, which defines the keys and types of the entries in the record.
Initializes a record type with a schema.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- name: ClassVar[str] = 'results.record'
The attribute name should be a static field in the attribute classes.
-
schema:
RecordSchemaAttr
- class ResultsArrayType(type_, size)
Bases:
ResultsArrayTypeA type that represents an array of results, which can be added to and filtered with given operations.
This is used to represent a collection of results that can be indexed into, e.g., a register of classical bits measured from a quantum circuit. It takes standard array semantics, holding an ordered list of results.
ResultsArrayTypeis modelled to be immutable, and must be complete when constructed.- Variables:
type – The type of the entries in the array.
size – The size of the array. The special value
DYNAMIC_INDEXindicates runtime-dynamic size.
Initializes an array type with element type and size.
- classmethod dynamic_size(type_)
Construct a
ResultsArrayTypewith a dynamic size.- Return type:
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- name: ClassVar[str] = 'results.array'
The attribute name should be a static field in the attribute classes.
-
size:
IntAttr
-
type:
TypeAttribute= <xdsl.irdl.attributes._ParameterDef object>
- class ResultsCollectionType(schema, size)
Bases:
ResultsCollectionTypeA type that represents a collection of results, which can be added to and filtered with given operations.
The collection is modelled as a collection of data which are referenced by two identifiers:
An integer index, which for example, might refer to the shot number.
A string key, which for example, might refer to the name of the result.
The actual data type is not specified to be index-major or key-major. This allows us to support flexible results acquisition. For example, you could treat this as a dictionary of arrays, and append a result to each array for each shot. Or you could treat this as a list of records, and append a new record for each shot.
- Variables:
schema – The schema of the records in the collection, which defines the keys and types.
size – The size of the collection. The special value
DYNAMIC_INDEXindicates runtime-dynamic size.
Initializes a collection type with schema and size.
- classmethod dynamic_size(schema)
Construct a
ResultsCollectionTypewith a dynamic size.- Return type:
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- name: ClassVar[str] = 'results.collection'
The attribute name should be a static field in the attribute classes.
-
schema:
RecordSchemaAttr
-
size:
IntAttr