braket.ir.jaqcd.shared_models module

class braket.ir.jaqcd.shared_models.SingleTarget[source]

Bases: pydantic.main.BaseModel

Single target index.

target

The target index. This is an int >= 0.

Type:int

Examples

>>> SingleTarget(target=0)

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.

class braket.ir.jaqcd.shared_models.DoubleTarget[source]

Bases: pydantic.main.BaseModel

Target indices of length 2.

targets

A list with two items and all items are int >= 0.

Type:List[int]

Examples

>>> DoubleTarget(targets=[0, 1])

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.

class braket.ir.jaqcd.shared_models.MultiTarget[source]

Bases: pydantic.main.BaseModel

Variable length target indices.

targets

A list with items that are all int >= 0.

Type:List[int]

Examples

>>> MultiTarget(targets=[0, 1])

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.

class braket.ir.jaqcd.shared_models.OptionalMultiTarget[source]

Bases: pydantic.main.BaseModel

Optional variable length target indices

targets

A list with items that are all int >= 0.

Type:Optional[List[int]]

Examples

>>> OptionalMultiTarget(targets=[0, 1])

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.

class braket.ir.jaqcd.shared_models.MultiControl[source]

Bases: pydantic.main.BaseModel

Variable length control indices.

controls

A list with at least two items and all items are int >= 0.

Type:List[int]

Examples

>>> MultiControl(controls=[0, 1])

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.

class braket.ir.jaqcd.shared_models.DoubleControl[source]

Bases: pydantic.main.BaseModel

Control indices of length 2.

controls

A list with two items and all items are int >= 0.

Type:List[int]

Examples

>>> DoubleControl(targets=[0, 1])

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.

class braket.ir.jaqcd.shared_models.SingleControl[source]

Bases: pydantic.main.BaseModel

Single control index.

control

The control index. This is an int >= 0.

Type:int

Examples

>>> SingleControl(control=0)

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.

class braket.ir.jaqcd.shared_models.Angle[source]

Bases: pydantic.main.BaseModel

Single angle in radians (floating point).

angle

The angle in radians. inf, -inf, and NaN are not allowable inputs.

Type:float

Examples

>>> Angle(angle=0.15)

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.

class braket.ir.jaqcd.shared_models.SingleProbability[source]

Bases: pydantic.main.BaseModel

A single probability parameter for bit/phase flip noise channel. The probability range is [0,0.5] to make the channel meaningful.

probability

The probability for noise channel. NaN is not an allowable input.

Type:float

Examples

>>> SingleProbability(probability=0.1)

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.

class braket.ir.jaqcd.shared_models.SingleProbability_34[source]

Bases: pydantic.main.BaseModel

A single probability parameter for depolarizing/two-qubit-dephasing noise channel. The probability range is [0,3/4], as the channel is fully mixing at p = 3/4.

probability

The probability for noise channel. NaN is not an allowable input.

Type:float

Examples

>>> SingleProbability_34(probability=0.5)

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.

class braket.ir.jaqcd.shared_models.SingleProbability_1516[source]

Bases: pydantic.main.BaseModel

A single probability parameter for two-qubit-depolarizing noise channel. The probability range is [0,15/16], as the channel is fully mixing at p = 15/16.

probability

The probability for noise channel. NaN is not an allowable input.

Type:float

Examples

>>> SingleProbability_1516(probability=0.1)

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.

class braket.ir.jaqcd.shared_models.DampingProbability[source]

Bases: pydantic.main.BaseModel

The parameter for the amplitude/phase damping channel

gamma

The probability of damping

Type:float

Examples

>>> DampingProbability(gamma=0.1)

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.

class braket.ir.jaqcd.shared_models.DampingSingleProbability[source]

Bases: pydantic.main.BaseModel

The parameter for the generalized amplitude damping channel

gamma

The probability of damping

Type:float

Examples

>>> DampingSingleProbability(probability=0.1)

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.

class braket.ir.jaqcd.shared_models.TripleProbability[source]

Bases: pydantic.main.BaseModel

A triple-probability parameter set for the Pauli noise channel.

probX

The coefficients of the

Type:float), probY (float), probZ (float
Pauli channel

Examples

>>> TripleProbability(probX=0.1, probY=0.2, probZ=0.3)

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.

classmethod validate_probabilities(values)[source]

Pydantic uses the validation subsystem to create objects. This custom validator has the purpose to ensure probX + probY + probZ <= 1.

class braket.ir.jaqcd.shared_models.TwoDimensionalMatrix[source]

Bases: pydantic.main.BaseModel

Two-dimensional non-empty matrix.

matrix

Two-dimensional matrix with complex entries. Each complex number is represented using a List[float] of size 2, with element[0] being the real part and element[1] imaginary. inf, -inf, and NaN are not allowable inputs for the element.

Type:List[List[List[float]]]

Examples

>>> TwoDimensionalMatrix(matrix=[[[0, 0], [1, 0]], [[1, 0], [0, 0]]])

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.

class braket.ir.jaqcd.shared_models.TwoDimensionalMatrixList[source]

Bases: pydantic.main.BaseModel

List of two-dimensional non-empty matrices.

matrix

Two-dimensional matrix with complex entries. Each complex number is represented using a List[float] of size 2, with element[0] being the real part and element[1] imaginary. inf, -inf, and NaN are not allowable inputs for the element. The number of matrices is limited to 16 and the size of each matrix is limited to 4*4.

Type:List[List[List[List[float]]]]

Examples

>>> TwoDimensionalMatrixList(matrices=[[[[1, 0], [0, 0]], [[0, 0], [1, 0]]],
                                       [[[0, 0], [1, 0]], [[1, 0], [0, 0]]]
                                      ]
                            )

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.

class braket.ir.jaqcd.shared_models.Observable[source]

Bases: pydantic.main.BaseModel

An observable. If given list is more than one element, this is the tensor product of each operator in the list.

observable

A list with at least one item and items are strings matching the observable regex or a two-dimensional hermitian matrix with complex entries. Each complex number is represented using a List[float] of size 2, with element[0] being the real part and element[1] imaginary. inf, -inf, and NaN are not allowable inputs for the element.

Type:List[Union[str, List[List[List[float]]]]

Examples

>>> Observable(observable=["x"])
>>> Observable(observable=[[[0, 0], [1, 0]], [[1, 0], [0, 0]]])

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.

class braket.ir.jaqcd.shared_models.MultiState[source]

Bases: pydantic.main.BaseModel

A list of states in bitstring form.

states

Variable length list with all strings matching the state regex

Type:List[string]

Examples

>>> lMultiState(states=["10", "10"])

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.

class braket.ir.jaqcd.shared_models.CompilerDirective[source]

Bases: pydantic.main.BaseModel

A Compiler Directive to preserve a block of code between StartVerbatimBlock and EndVerbatimBlock directives.

directive
Type:List [StartVerbatimBlock | EndVerbatimBlock]

Examples

>>> CompilerDirective (directive="StartVerbatimBlock")
>>> CompilerDirective (directive="EndVerbatimBlock")

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.