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]

property data : Tensor

The data tensor of this state

property system_dim : list[int]

The list of dimensions for each system

property rank : list[int]

The rank of the state.

abstract 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)\)

property system_seq : list[int]

The system order of this state

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)\)

to_mixed()

Convert the pure state to mixed state computation.

property system_seq : list[int]

The system order of this state

product_trace(trace_state, trace_idx)

Partial trace over this state, when this state is a product state