braket.ir.openqasm.program_set_v1 module
- class braket.ir.openqasm.program_set_v1.ProgramSet(*, braketSchemaHeader: BraketSchemaHeader = BraketSchemaHeader(name='braket.ir.openqasm.program_set', version='1'), programs: ConstrainedListValue[Program])[source]
Bases:
BraketSchemaBaseOpenQASM Program Set.
- braketSchemaHeader
Schema header. Users do not need to set this value. Only default is allowed.
- Type:
- programs
The list of programs that will be executed as part of the program set.
- Type:
list[Program]
Examples
>>> ProgramSet(programs=[Program(source="OPENQASM 3.0; input float alpha; qubit[2] q; bit[2] c; rx(alpha) q[0]; h q[0]; cx q[0], q[1]; c = measure q;", inputs={"alpha": [0.0, 3.141516]}), # noqa: E501 {"source": "OPENQASM 3.0; input angle alpha; input angle beta; qubit[2] q; bit[2] c; rx(alpha * beta) q[0]; c = measure q;", "inputs": {"alpha": [1.0, 2.0], "beta": [3.141516]}}]) # noqa: E501
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- braketSchemaHeader: BraketSchemaHeader
- classmethod validate_program_inputs(program) Program[source]
Validates program input lists for uniform length and type.
- Parameters:
program (Program) – One Program item from the programs list.
- Returns:
program (Program) –
- The same Program, but the inputs have been
validated to be correct for a ProgramSet
- Raises:
ValueError – If inputs aren’t lists or have unequal lengths.
Note
Used by Pydantic’s validation system to ensure: 1. All inputs are lists 2. All input lists have equal length
- property num_executables_per_program: list[int]
- Returns
- num_executables_per_program (list[int]): A list of the number of
executables for each program in the same order as the programs.
- Raises:
ValueError – If inputs aren’t lists or have unequal lengths.
- property num_executables: int
- Returns
num_executables (int): Number of total program executions
- Raises:
ValueError – If inputs aren’t lists or have unequal lengths.
- property num_programs: int