braket.ir.jaqcd.results module

class braket.ir.jaqcd.results.Expectation(*, observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue, targets: ConstrainedListValue[ConstrainedIntValue] | None = None, type: Type = Type.expectation)[source]

Bases: OptionalMultiTarget, Observable

Expectation of specified targets and observable as requested result. If no targets are specified, the observable must only operate on 1 qubit and it will be applied to all qubits in parallel. Otherwise, the number of specified targets must be equivalent to the number of qubits the observable can be applied to.

type

The result type. default = “expectation”. (type) is optional. This should be unique among all result types.

Type:

str

targets

The target qubits. This is a list of int >= 0.

Type:

Optional[List[int]]

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

>>> Expectation(targets=[1], observable=["x"])

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 Type(value)[source]

Bases: str, Enum

An enumeration.

expectation = 'expectation'
targets: ConstrainedListValue[ConstrainedIntValue] | None
class braket.ir.jaqcd.results.AdjointGradient(*, parameters: ConstrainedListValue[ConstrainedStrValue] | None = None, observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue, targets: ConstrainedListValue[ConstrainedListValue[ConstrainedIntValue]] | None = None, type: Type = Type.adjoint_gradient)[source]

Bases: OptionalNestedMultiTarget, Observable, OptionalMultiParameter

Adjoint Gradient as requested result. .. attribute:: type

The result type. default = “adjoint_gradient”. (type) is optional. This should be unique among all result types.

type:

str

targets

The target qubits. This is a two dimensional nested list of ints >= 0.

Type:

Optional[List[List[int]]]

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]]]]

parameters

The parameters used in the adjoint gradient calculation. This is a list of parameter names. Default: all parameters.

Type:

List[str]

Examples

>>> AdjointGradient(
>>>     targets=[[1, 2], [3]],
>>>     observable=["2 * x @ y + z"],
>>>     parameters=["theta", "beta"]
>>> )

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 Type(value)[source]

Bases: str, Enum

An enumeration.

adjoint_gradient = 'adjoint_gradient'
targets: ConstrainedListValue[ConstrainedListValue[ConstrainedIntValue]] | None
class braket.ir.jaqcd.results.Sample(*, observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue, targets: ConstrainedListValue[ConstrainedIntValue] | None = None, type: Type = Type.sample)[source]

Bases: OptionalMultiTarget, Observable

Sample for specified targets and observable as requested result. If no targets are specified, the observable must only operate on 1 qubit and it will be applied to all qubits in parallel. Otherwise, the number of specified targets must be equivalent to the number of qubits the observable can be applied to.

type

The result type. default = “sample”. (type) is optional. This should be unique among all result types.

Type:

str

targets

The target qubits. This is a list of int >= 0.

Type:

Optional[List[int]]

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

>>> Sample(targets=[1], observable=["x"])

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 Type(value)[source]

Bases: str, Enum

An enumeration.

sample = 'sample'
targets: ConstrainedListValue[ConstrainedIntValue] | None
class braket.ir.jaqcd.results.Variance(*, observable: ConstrainedListValue[ConstrainedStrValue | ConstrainedListValue[ConstrainedListValue[ConstrainedListValue[ConstrainedFloatValue]]]] | ConstrainedStrValue, targets: ConstrainedListValue[ConstrainedIntValue] | None = None, type: Type = Type.variance)[source]

Bases: OptionalMultiTarget, Observable

Variance of specified targets and observables as requested result. If no targets are specified, the observable must only operate on 1 qubit and it will be applied to all qubits in parallel. Otherwise, the number of specified targets must be equivalent to the number of qubits the observable can be applied to.

type

The result type. default = “variance”. (type) is optional. This should be unique among all result types.

Type:

str

targets

The target qubits. This is a list of int >= 0.

Type:

List[int]

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

>>> Variance(targets=[1], observable=["x"])

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 Type(value)[source]

Bases: str, Enum

An enumeration.

variance = 'variance'
targets: ConstrainedListValue[ConstrainedIntValue] | None
class braket.ir.jaqcd.results.StateVector(*, type: Type = Type.statevector)[source]

Bases: BaseModel

The full state vector as requested result.

type

The result type. default = “statevector”. (type) is optional. This should be unique among all result types.

Type:

str

Examples

>>> StateVector()

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 Type(value)[source]

Bases: str, Enum

An enumeration.

statevector = 'statevector'
class braket.ir.jaqcd.results.DensityMatrix(*, targets: ConstrainedListValue[ConstrainedIntValue] | None = None, type: Type = Type.densitymatrix)[source]

Bases: OptionalMultiTarget

The density matrix as requested result.

type

The result type. default = “densitymatrix”. (type) is optional. This should be unique among all result types.

Type:

str

targets

The target qubits of the reduced density matrix.

Type:

Optional[List[int]]

This is a list of int >= 0.

Examples

>>> DensityMatrix()

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 Type(value)[source]

Bases: str, Enum

An enumeration.

densitymatrix = 'densitymatrix'
targets: ConstrainedListValue[ConstrainedIntValue] | None
class braket.ir.jaqcd.results.Amplitude(*, states: ConstrainedListValue[ConstrainedStrValue], type: Type = Type.amplitude)[source]

Bases: MultiState

Amplitudes of specified states as requested result.

type

The result type. default = “amplitude”. (type) is optional. This should be unique among all result types.

Type:

str

states

Variable length list with with all strings matching the state regex

Type:

List[string]

Examples

>>> Amplitude(states=["01", "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 Type(value)[source]

Bases: str, Enum

An enumeration.

amplitude = 'amplitude'
states: ConstrainedListValue[ConstrainedStrValue]
class braket.ir.jaqcd.results.Probability(*, targets: ConstrainedListValue[ConstrainedIntValue] | None = None, type: Type = Type.probability)[source]

Bases: OptionalMultiTarget

Probability of all states if no targets are specified or the marginal probability

of a restricted set of states if only a subset of all qubits are specified as targets

type

The result type. default = “probability”. (type) is optional. This should be unique among all result types.

Type:

str

targets

The target qubits. This is a list of int >= 0.

Type:

Optional[List[int]]

Examples

>>> Probability(targets=[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.

class Type(value)[source]

Bases: str, Enum

An enumeration.

probability = 'probability'
targets: ConstrainedListValue[ConstrainedIntValue] | None