Skip to content
Pasqal Documentation

QutipOperator

class pulser_simulation.QutipOperator(operator, eigenstates)

Bases: Operator[SupportsComplex, complex, QutipStateType]

A quantum operator stored as a qutip.Qobj.

Parameters:
  • state – The operator as a qutip.Qobj.

  • eigenstates (Sequence[Literal['u', 'd', 'r', 'g', 'h', 'x'] | Literal['0', '1']]) – The eigenstates that form a qudit’s eigenbasis, each given as an individual character. The order of the eigenstates matters, as for eigenstates (“a”, “b”, …), “a” will be associated to eigenvector (1, 0, …), “b” to (0, 1, …) and so on.

Attributes

eigenstates

The eigenstates that form a qudit's eigenbasis.

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.

to_qobj

Returns a copy of the operators's Qobj representation.

Signatures

apply_to(state, /)

Apply the operator to a state.

Parameters:

state (TypeVar(QutipStateType, bound= QutipState)) – The state to apply this operator to.

Return type:

TypeVar(QutipStateType, bound= QutipState)

Returns:

The resulting state.

expect(state, /)

Compute the expectation value of self on the given state.

Parameters:

state (QutipState) – The state with which to compute.

Return type:

complex

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.

to_qobj()

Returns a copy of the operators’s Qobj representation.

Return type:

Qobj

property eigenstates: tuple[Literal['u', 'd', 'r', 'g', 'h', 'x', '0', '1'], ...]

The eigenstates that form a qudit’s eigenbasis.

The order of the states should match the order in a numerical (ie state vector or density matrix) representation. For example, with eigenstates (“a”, “b”, …), “a” will be associated to eigenvector (1, 0, …), “b” to (0, 1, …) and so on.