quairkit.core.state.backend.default

The module that implements the default backend of the state.

class quairkit.core.state.backend.default.DefaultSimulator(data, sys_dim, system_seq, probability)

The abstract base class for default simulators of quantum states in QuAIRKit.

static fetch_initializer(shape)

Determine whether the input data should be a (batch of) pure/mixed state in 'default' backend.

Note

When the backend is set as 'default', the default initializer of this state is determined by the table

single

batch

state_vector

[d], [1, d], [d, 1]

[d1, …, dn, d, 1]

density_matrix

[d, d]

[d1, …, dn, d, d]

abstractmethod to_prod_sum(subgroup_indices, tol=None)

Convert the state into a subgroup-level product-sum container.

property rank : int | list[int]

The rank of the state.

property system_seq : list[int]

The system order of this state

reset_sequence()

reset the system order to default sequence i.e. from 0 to n - 1.

class quairkit.core.state.backend.default.MixedState(data, sys_dim, system_seq, probability)

The mixed state class.

Parameters:
data : Tensor

tensor array (in density matrix representation) for quantum mixed state(s).

sys_dim : List[int]

a list of dimensions for each system.

system_seq : List[int] | None

the system order of this state. Defaults to be from 0 to n - 1.

probability : List[Tensor] | None

list of state probability distributions. Defaults to be 1.

Note

The data is stored in the matrix-form with shape \((-1, d, d)\)

class quairkit.core.state.backend.default.PureState(data, sys_dim, system_seq, probability)

The pure state class.

Parameters:
data : Tensor

tensor array in vector representation for quantum pure state(s).

sys_dim : List[int]

a list of dimensions for each system.

system_seq : List[int] | None

the system order of this state. Defaults to be from 1 to n.

probability : List[Tensor] | None

tensor array for state distributions. Defaults to be 1.

Note

The data is stored in the vector-form with shape \((-1, d)\)

class quairkit.core.state.backend.default.ProductDefaultSimulator(*args, **kwargs)

Default-backend-only product state container composed of dense blocks.

Parameters:
list_state

Dense component states. Each element must be a single-block DefaultSimulator subclass, i.e. PureState or MixedState.

list_state_idx

Global subsystem indices covered by each block in list_state. The i-th entry gives the subsystem labels represented by list_state[i].

_prob

Shared probability history stored at the container level. Dense blocks inside list_state must not carry their own probability history.

_roles

Per-probability-dimension metadata used only by ProductDefaultSimulator to distinguish classical dimensions from internal product-sum coefficient dimensions.

_keep_dim

Whether to preserve singleton batch dimensions when converting back to dense states.

Note

For internal usage only.