braket.ir.jaqcd.program_v1 module

class braket.ir.jaqcd.program_v1.Program(*, braketSchemaHeader: BraketSchemaHeader = BraketSchemaHeader(name='braket.ir.jaqcd.program', version='1'), instructions: List[Any], results: List[Amplitude | Expectation | Probability | Sample | StateVector | DensityMatrix | Variance | AdjointGradient] | None = None, basis_rotation_instructions: List[Any] | None = None)[source]

Bases: BraketSchemaBase

Root object of the JsonAwsQuantumCircuitDescription IR.

braketSchemaHeader

Schema header. Users do not need to set this value. Only default is allowed.

Type:

BraketSchemaHeader

instructions

List of instructions.

Type:

List[Any]

basis_rotation_instructions

List of instructions for rotation to desired measurement bases. Default is None.

Type:

List[Any]

results (List[Union[Amplitude, Expectation, Probability, Sample, StateVector,
DensityMatrix, Variance]])

List of requested results. Default is None.

Examples

>>> Program(instructions=[H(target=0), Rz(angle=0.15, target=1)])
>>> Program(instructions=[H(target=0), CNot(control=0, target=1)],
...     results=[Expectation(targets=[0], observable=['x'])],
...     basis_rotation_instructions=[H(target=0)])

Note

The following instructions are supported: AmplitudeDamping, BitFlip, CCNot, CNot, CPhaseShift, CPhaseShift00, CPhaseShift01, CPhaseShift10, CSwap, CV, CY, CZ, ECR, Depolarizing, GeneralizedAmplitudeDamping, Pauli_channel, H, I, ISwap, Kraus, PhaseDamping PhaseFlip, PhaseShift, PSwap, Rx, Ry, Rz, S, Swap, Si, T, Ti, TwoQubitDephasing, TwoQubitDepolarizing, Unitary, V, Vi, X, XX, XY, Y, YY, Z, ZZ

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
instructions: List[Any]
results: List[Amplitude | Expectation | Probability | Sample | StateVector | DensityMatrix | Variance | AdjointGradient] | None
basis_rotation_instructions: List[Any] | None
classmethod validate_instructions(value, field)[source]

Pydantic uses the validation subsystem to create objects. This custom validator has 2 purposes: 1. Implement O(1) deserialization 2. Validate that the input instructions are supported