quairkit.operator.special

The source file of the class for the special quantum operator.

class quairkit.operator.special.ResetState

The class to reset the quantum state. It will be implemented soon.

forward(*inputs, **kwargs)

The forward function.

Returns:

NotImplemented.

class quairkit.operator.special.Collapse(system_idx, desired_result=None, if_print=False, measure_basis=None)

The class to compute the collapse of the quantum state.

Parameters:
system_idx : int | Iterable[int]

list of systems to be collapsed.

desired_result : int | str

The desired result you want to collapse. Defaults to None meaning preserving all results,

computation. : and activate probabilistic

if_print : bool

whether print the information about the collapsed state. Defaults to False.

measure_basis : Tensor | None

The basis of the measurement. Defaults to the computational basis.

Raises:

NotImplementedError – If the basis of measurement is not z. Other bases will be implemented in future.

Note

When desired_result is None, Collapse does not support gradient calculation

forward(state)

Compute the collapse of the input state.

Parameters:
state : State

The input state, which will be collapsed

Returns:

The collapsed quantum state.

Return type:

State

class quairkit.operator.special.OneWayLOCC(list_unitary, system_idx=None, acted_system_dim=2, measure_basis=None)

A one-way LOCC protocol, where quantum measurement is modelled by a PVM and all channels are unitary channels.

Parameters:
list_unitary : Tensor

a batched tensor that represents all unitaries.

system_idx : Iterable[int] | int

Indices of the systems on which the protocol is applied. The first element in the list

measured. : indexes systems to be

acted_system_dim : List[int] | int

dimension of systems that unitary channels act on. Can be a list of system dimensions

case. : or an int representing the dimension of all systems. Defaults to be qubit

measure_basis : Tensor | None

The basis of the measurement. Defaults to the computational basis.

forward(state)

Compute the input state passing through the LOCC protocol.

Parameters:
state : State

The input state.

Returns:

The collapsed quantum state.

Return type:

State

class quairkit.operator.special.QuasiOperation(list_channels, quasi_prob, system_idx=None, type_repr='gate', acted_system_dim=2)

A quantum protocol containing quasi-operations.

Parameters:
list_channels : Tensor

a batched tensor that represents all unitaries.

quasi_prob : Tensor

the quasi-probability distribution for this quasi-operation.

system_idx : Iterable[int] | int

indices of the systems on which the protocol is applied.

type_repr : str

one of 'choi', 'kraus', 'stinespring' or 'gate'. Defaults to 'gate'.

acted_system_dim : List[int] | int

dimension of systems that these channels act on. Can be a list of system dimensions

case. : or an int representing the dimension of all systems. Defaults to be qubit

forward(state)

Compute the input state passing through the quasi-operation.

Parameters:
state : State

The input state.

Returns:

The collapsed quantum state.

Return type:

State