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 randomly choose one.

if_print : bool

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

measure_basis : Tensor | None

The basis of the measurement. The quantum state will collapse to the corresponding eigenstate.

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