braket.ir.jaqcd.shared_models module

class braket.ir.jaqcd.shared_models.SingleTarget(*, target: ConstrainedIntValue)[source]

Bases: 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.

target: ConstrainedIntValue
class braket.ir.jaqcd.shared_models.DoubleTarget(*, targets: ConstrainedListValue[ConstrainedIntValue])[source]

Bases: 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.

targets: ConstrainedListValue[ConstrainedIntValue]
class braket.ir.jaqcd.shared_models.MultiTarget(*, targets: ConstrainedListValue[ConstrainedIntValue])[source]

Bases: 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.

targets: ConstrainedListValue[ConstrainedIntValue]
class braket.ir.jaqcd.shared_models.OptionalMultiTarget(*, targets: ConstrainedListValue[ConstrainedIntValue] | None = None)[source]

Bases: 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.

targets: ConstrainedListValue[ConstrainedIntValue] | None
class braket.ir.jaqcd.shared_models.OptionalNestedMultiTarget(*, targets: ConstrainedListValue[ConstrainedListValue[ConstrainedIntValue]] | None = None)[source]

Bases: BaseModel

Optional variable length nested target indices for Hamiltonians

targets

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

Type:

Optional[List[int]]

Examples

>>> OptionalNestedMultiTarget(targets=[[0, 1], [2]])

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.

targets: ConstrainedListValue[ConstrainedListValue[ConstrainedIntValue]] | None
class braket.ir.jaqcd.shared_models.OptionalMultiParameter(*, parameters: ConstrainedListValue[ConstrainedStrValue] | None = None)[source]

Bases: BaseModel

Variable length parameter names. .. attribute:: parameters

A list of parameter names.

type:

Optional[List[str]]

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.

parameters: ConstrainedListValue[ConstrainedStrValue] | None
class braket.ir.jaqcd.shared_models.MultiControl(*, controls: ConstrainedListValue[ConstrainedIntValue])[source]

Bases: 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.

controls: ConstrainedListValue[ConstrainedIntValue]
class braket.ir.jaqcd.shared_models.DoubleControl(*, controls: ConstrainedListValue[ConstrainedIntValue])[source]

Bases: 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.

controls: ConstrainedListValue[ConstrainedIntValue]
class braket.ir.jaqcd.shared_models.SingleControl(*, control: ConstrainedIntValue)[source]

Bases: 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.

control: ConstrainedIntValue
class braket.ir.jaqcd.shared_models.Angle(*, angle: ConstrainedFloatValue)[source]

Bases: 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.

angle: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.SingleProbability(*, probability: ConstrainedFloatValue)[source]

Bases: 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.

probability: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.SingleProbability_34(*, probability: ConstrainedFloatValue)[source]

Bases: 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.

probability: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.SingleProbability_1516(*, probability: ConstrainedFloatValue)[source]

Bases: 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.

probability: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.DampingProbability(*, gamma: ConstrainedFloatValue)[source]

Bases: 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.

gamma: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.DampingSingleProbability(*, probability: ConstrainedFloatValue)[source]

Bases: 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.

probability: ConstrainedFloatValue
class braket.ir.jaqcd.shared_models.TripleProbability(*, probX: ConstrainedFloatValue, probY: ConstrainedFloatValue, probZ: ConstrainedFloatValue)[source]

Bases: 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.

probX: ConstrainedFloatValue
probY: ConstrainedFloatValue
probZ: ConstrainedFloatValue
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.MultiProbability(*, probabilities: Dict[ConstrainedStrValue, ConstrainedFloatValue])[source]

Bases: BaseModel

A multi-value-probability parameter set for the Pauli noise channel.

probabilities[Dict, str, float]

The coefficients of the Pauli channel

Examples

>>> MultiProbability(probabilities={"X": 0.1})
>>> MultiProbability(probabilities={"XY": 0.1, "YX": 0.01})

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.

probabilities: Dict[ConstrainedStrValue, ConstrainedFloatValue]
classmethod validate_probabilities(values)[source]

Pydantic uses the validation subsystem to create objects. This custom validator has the purpose to ensure sum(probabilities) <= 1 and that the lengths of each Pauli string are equal.

class braket.ir.jaqcd.shared_models.TwoDimensionalMatrix(*, matrix: ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]])[source]

Bases: 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.

matrix: ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]
class braket.ir.jaqcd.shared_models.TwoDimensionalMatrixList(*, matrices: ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]])[source]

Bases: 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.

matrices: ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]]
class braket.ir.jaqcd.shared_models.Observable(*, observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue)[source]

Bases: 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. Alternatively, a string constructing an observable in Hamiltonian format.

Type:

Union[List[Union[str, List[List[List[float]]]], str]

Examples

>>> Observable(observable=["x"])
>>> Observable(observable=[[[0, 0], [1, 0]], [[1, 0], [0, 0]]])
>>> Observable(observable="2 * x @ y + 3 * z")

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.

observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue
class braket.ir.jaqcd.shared_models.MultiState(*, states: ConstrainedListValue[ConstrainedStrValue])[source]

Bases: 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.

states: ConstrainedListValue[ConstrainedStrValue]
class braket.ir.jaqcd.shared_models.CompilerDirective(*, directive: ConstrainedStrValue)[source]

Bases: 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.

directive: ConstrainedStrValue