Skip to content

Results are limited to Pulser v1.9.1

Product news
You are reading Pulser v1.9.1, an older version of this documentation. Go to the latest version (v1.10.0)

Operator

class pulser.backend.Operator

Bases: ABC, Generic[ArgScalarType, ReturnScalarType, StateType]

Base class enforcing an API for quantum operator.

Each backend will implement its own type of state and the methods below.

Methods

apply_to

Apply the operator to a state.

expect

Compute the expectation value of self on the given state.

from_operator_repr

Create an operator from the operator representation.

Signatures

abstract apply_to(state, /)

Apply the operator to a state.

Parameters:

state (TypeVar(StateType, bound= State)) – The state to apply this operator to.

Return type:

TypeVar(StateType, bound= State)

Returns:

The resulting state.

abstract expect(state, /)

Compute the expectation value of self on the given state.

Parameters:

state (TypeVar(StateType, bound= State)) – The state with which to compute.

Return type:

TypeVar(ReturnScalarType)

Returns:

The expectation value.

classmethod from_operator_repr(*, eigenstates, n_qudits, operations)

Create an operator from the operator representation.

Only operators constructed with this method are allowed in remote backend.

The full operator representation (FullOp) is a weigthed sum of tensor operators (TensorOp), written as a sequence of coefficient and tensor operator pairs, ie

FullOp = Sequence[tuple[ScalarType, TensorOp]]

Each TensorOp is itself a sequence of qudit operators (QuditOp) applied to mutually exclusive sets of qudits (represented by their indices), ie

TensorOp = Sequence[tuple[QuditOp, Collection[int]]]

Qudits without an associated QuditOp are applied the identity operator.

Finally, each QuditOp is represented as weighted sum of pre-defined single-qudit operators. It is given as a mapping between a string representation of the single-qudit operator and its respective coefficient, ie

QuditOp = Mapping[str, ScalarType]

By default, it identifies strings "ij" as single-qudit operators, where i and j are eigenstates that denote |i><j|.

Parameters:
  • eigenstates (Sequence[Literal['u', 'd', 'r', 'g', 'h', 'x'] | Literal['0', '1']]) – The eigenstates to use.

  • n_qudits (int) – How many qudits there are in the system.

  • operations (Sequence[tuple[TypeVar(ArgScalarType), Sequence[tuple[Mapping[str, TypeVar(ArgScalarType)], Collection[int]]]]]) – The full operator representation.

Return type:

TypeVar(OperatorType, bound= Operator)

Returns:

The constructed operator.